Professional Documents
Culture Documents
List Sorts
When sorting lists with large records, it is
k1
k2
k3
kn
Example
(c) Configuration after first iteration of the for loop of List 1, first=2
Example
(a) Configuration after first iteration of the for loop of List2, first=2
Table Sort
The list sort technique is not well suited for quick sort and
heap sort
We can use auxiliary table
At the start of the sort, t[i] i,1 i .nIf the sorting function
requires a swap of a[i] and a[j], then only the table entries
(i.e., t[i] and t[j]) need to be swapped.
At the end of sort, the record with the smallest key is a[t[1]]
and that with the largest key a[t[n]]
Method
Insertion Sort
Heap Sort
Merge Sort
Quick Sort
15
Worst
Average
Insertion Sort
Heap Sort
Merge Sort
Quick Sort
0
0
500
1000
2000
3000
4000
5000