Heap sort

medium

The tree and the array below it are the same memory - watch a swap change both at once. The only sort here with an O(n log n) guarantee and O(1) extra space.

Best O(n log n)Average O(n log n)Worst O(n log n)Space O(1)Not stableIn place
Loading the heap sort engine…

Where to go next