Heap Sort

Back to Comparison-Based

Builds a max-heap from the array and repeatedly extracts the maximum element to build the sorted output. O(n log n) guaranteed time, in-place, but not stable. Useful when worst-case guarantees are needed without extra space.

algorithms sorting heap-sort