Please wait
Loading technology simulations
The requested content is still loading.
Finished experimenting?
Save one completion to this browser's signed guest ledger, or directly to your account when signed in.
Please wait
Loading technology simulations
The requested content is still loading.
Save one completion to this browser's signed guest ledger, or directly to your account when signed in.
| impl | insert | extract-min |
|---|---|---|
| binary heap | O(log n) | O(log n) |
| sorted array | O(n) | O(1) |
| unsorted array | O(1) | O(n) |
1push(v):2 append v at the end3 while v < parent:4 swap with parent (bubble up)5 // heap property restored
This binary heap simulator shows the priority queue that powers Dijkstra, Prim's MST, Huffman coding, and event schedulers. Insert a value and watch it append to the end then bubble up while it's smaller than its parent; extract-min removes the root, moves the last element up, and sifts it down past its smaller child — both in O(log n). The tree and its flat backing array are drawn together with synced highlights, making the key insight concrete: a heap needs no pointers because index i's children live at 2i+1 and 2i+2. A cost card contrasts the heap with sorted- and unsorted-array priority queues, and the signature interaction, Predict mode, pauses on each insert to ask whether the new value bubbles up or settles — active recall of the heap property.
binary heap · priority queue · min-heap · sift up sift down · heapify · array-backed tree · O(log n) operations
Browse all Technology simulations →
Free to use in your browser — no signup required. Found a bug or have an idea to make it better? Tell us.