Heap Sort
Heap sort builds a heap in the array, then repeatedly moves the root to the end. Building the heap is linear. Each of the n removals is logarithmic.
Costs
| Category | Algorithm |
| Difficulty | Medium |
| Time | O(n log n) |
| Extra memory | O(1) |
| Stable | no |
Questions
What is Heap Sort?
Heap sort builds a heap in the array, then repeatedly moves the root to the end. Building the heap is linear. Each of the n removals is logarithmic.
Where do I practice it?
DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.