Heap Sort
Heap Sort builds a max-heap for ascending order, then repeatedly moves the maximum element to the end and restores the heap property over the remaining prefix. It guarantees O(n log n) time and can be performed in-place.
Build heap: O(n).
Each extraction: O(log n).
Total: O(n log n).
Auxiliary space: O(1) for an iterative in-place implementation.
Standard Heap Sort is not stable.