Heap Sort
Turn the array into a heap, then repeatedly pull out the largest. O(n log n) guaranteed, with no extra memory.
7 min readUpdated 2026-09-01sortingheap-sort
Turn the array into a heap, then repeatedly pull out the largest. O(n log n) guaranteed, with no extra memory.