Skip to main content

Heap Sort

Build a max-heap in O(n) in-place, then repeatedly swap the root maximum to the shrinking tail in O(n log n).

Open the lesson