Binomial Heap Merge
Merge two heaps by linking trees of equal degree like binary addition.
Decision · step 2 of 9Binomial and Fibonacci Heaps: Merge two binomial heaps
Degree 0: 2 trees, rooted at 55, 8. Two of a kind: link them, and the result is a B1 that joins the next degree.
What you will see
Trees of equal size pair up and link; a carry propagates.
Cost
| Best | O(log n) |
|---|---|
| Average | O(log n) |
| Worst | O(log n) |
| Space | O(1) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.
Screen readers: Nodes announce value, parent and children; each step announces the comparison and whether the value moves up or down.
Reduced motion: Swaps become value crossfades in both the tree and the array view.
Before this
Taught by the same lesson
Binomial and Fibonacci Heaps covers these too, in the same run.