We looked at merge sort (, ), Insertion sort (, ), and quick sort .
Heap sort
is an array to be sorted. Define parent, left, right. This makes the array into what’s called at heap. A max heap satisfies , and a min heap satisfies .
max heapify is a recursive trickle down subroutine that max heapifies a heap given that the left and right subheaps of the root are max heaps, in time. Heap sort calls max heapify times, starting from the leaves and working its way upwards.
Theorem 124.1.
Any comparison based sort algorithm requires comparisons in the worst case.