Interactive heap sort. Build a max-heap, then repeatedly swap the root (max) to the end and sift the new root down.

Heap tree · array view in heap focus compare child swap locked
Step 0 / 0Build

Press Play. First build a max-heap (parent ≥ children), then pull the max off the top n−1 times.

Speed
comparisons
0
swaps
0
phase
Build
progress
0%
build max-heap (bottom-up)
heapify each non-leaf down
repeat n-1 times:
swap root (max) to the end
shrink heap by one
sift-down the new root
timeline0 / 0
space  walk steps