Heapsort

Builds heap, repeatedly extracts max/min to produce sorted order.

Method

Heapify O(n); extract-min O(log n) each.

Applications

Schedulers, Dijkstra, top-k, streaming.

Advantages

In-place, O(n log n), no extra memory.

Limitations

Not stable; slower in practice than quick sort.

Example

Sorting 1M numbers needs no extra array.

Sources

Educational reference only, not professional advice.

All algorithms