Heap Sort
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.
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.