Heapsort
Build a max-heap and repeatedly place its maximum at the end of the remaining range.
Remember: Heap root → sorted suffix.
Example: [2,3,1] → heap [3,2,1] → [2,1,3] → [1,2,3].
Time: O(n log n). Auxiliary space: O(1).
Formula: Build max-heap O(n); repeatedly swap root to end and sift down
Up to 15 integers. Iterative sift-down, unstable. The sorted suffix grows from the right. Not the same operation as merely building a heap.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.