Ch2 Part III-Advanced Sorting Algorithms
Ch2 Part III-Advanced Sorting Algorithms
algorithms
Quick Sort
Shell sort
Heap Sort
merge sort (Covered before)
• In the worst case, the largest or smallest item is picked as the pivot.
• Quicksort makes a pass over all elements in the array (in linear time) to sort just a single
item in the array
• If this process is repeated n − 1 times, it will result in O(n2) worst-case behavior
• First, we have to construct a heap from the given array and convert it into max
heap.
Questions ?