DSA Heap Visualizer

Pick min or max, then watch the heap work: insert numbers one by one (sift-up), extract the root (sift-down), heapify a whole list, or run heap sort — every compare and swap animated in the tree and in the array underneath it.

Build & operate

Switching the kind starts a fresh session.

Both phases: build the heap (O(n)), then extract until the array is sorted (O(n log n)). With no heap on screen it builds one from the list above.

Course examples

The two worked examples from the course pages. Each starts a fresh session and switches to the kind of heap that page builds.

Tree view

The heap is empty — insert a number or heapify a list.

Array view

[] — empty.

An empty min-heap. Insert numbers one by one, heapify a whole list, or press Heap sort to run both of its phases on that list.

Heap property holds (trivially)
step 0 / 0