Binary Heap — pick a scenario
0/4 donePick one and press Start, then click Next › to step through it.
Watch forThe amber key hopping up one level at a time until it settles just below a key it cannot beat.
More about this scenario
You'll learnWhy an insert costs only O(log n): the new key rises along a single chain of ancestors, never touching the rest of the tree.
How it runsThe key lands in the next free slot, then compares against its parent and swaps upward while it is smaller, stopping when a smaller parent blocks it.