← Back to Index

Heap Sort

Bars + Heap Tree
Ready
Phase
0
Comparisons
0
Swaps
0
Heap Size
Ready
Status
Heap
Compare
Swap
Sorted

Array View

Build a max heap, then keep moving the root to the end.

Heap Tree

How It Works

Heap sort keeps the largest value at the root of a max heap. First it heapifies the array bottom-up, then it swaps the root into the sorted suffix and restores heap order on the remaining prefix.