# Is there a simple, intuitive explanation for why trees in Fibonacci heaps have the sizes they do?

Fibonacci heaps have a simple rule that ensures its tree sizes grow exponentially with their ranks:

A node can lose at most one child. Once that child is lost, the node must be cut from its parent.

I'm comfortable with the proof that a tree in a Fibonacci heap of rank $$r$$ has at least $$F_{r+2}$$ nodes, and can prove it cleanly use induction.

However, I don't have any intuitive understanding as to why the above rule would give rise to Fibonacci numbers this way. The "default" shape of the trees in a Fibonacci heap is given by the binomial trees, which have lots of nice mathematical properties but none that (immediately) seem like they'd translate into Fibonacci numbers after nodes are lost this way. The best guess I have is that this somehow relates to writing Fibonacci numbers as sums of diagonal binomial coefficients, but I don't see a way to connect that sum to the trees produced this way.

Is there a simple, intuitive, and, most importantly, non-inductive explanation as to why the marking rule in Fibonacci heaps would give rise to Fibonacci-sized trees?

• Think about what happens to a Binomial tree if, from every internal node, you remove the maximum-degree child (and the subtree rooted at that child). Per the proof that you refer to, doesn't this give you the maximum size Fibonacci tree (with root of a given degree)? And isn't the number of nodes in the resulting tree the appropriate Fibonacci number? – Neal Young May 8 at 14:01
• I understand that that’s how you’d make the tree with the fewest nodes, and I can use induction to formalize that this gives back the Fibonacci numbers. But I don’t have a deep intuition as to why starting with binomial trees (based on powers of two / binomial coefficients) and removing one child from each tree this way (feels like subtracting powers of two?) would give the Fibonacci sequence. – templatetypedef May 8 at 15:18
• It just changes the recurrence... not sure there's any more to say.. – Neal Young May 8 at 16:35

I posed this question as a challenge to my students and I'm proud to report that they did not disappoint! Here's an argument based on ones developed by my students Kevin Tan and Max Arseneault, providing an intuition as to how the marking rule, applied to binomial trees, gives rise to the Fibonacci sequence.

Our goal will be to find a lower bound on the number of nodes that can be in a tree in a Fibonacci heap that has order $$k$$. We'll say that a maximally damaged tree of order $$k$$ is a binomial tree of order $$k$$ that has lost as many nodes as possible while obeying the Fibonacci heap marking rules, subject to the restriction that the root node still has $$k$$ children (and, thus, the tree has order $$k$$). For example, here's the first few maximally damaged trees: Notice that cutting any of the remaining nodes from their parents would trigger a cascading cut that removes a child from the root.

Our goal will be to show that if $$MD[n]$$ denotes the number of nodes in a maximally-damaged tree of order $$k$$, then $$MD[n]$$ satisfies the recurrence relation

$$MD[k+2] = MD[k] + MD[k+1],$$

at which point it's no longer surprising that we see the Fibonacci sequence popping up.

To do so, consider a binomial tree of order $$k+2$$, like the one shown here: We'd like to remove as many nodes from this tree as we can without cutting any direct children of the root. To do so, we'll imagine partitioning the nodes in this tree into two binomial trees of order $$k+1$$ by separating out the order-$$k+1$$ child from the remaining children, as shown here: We haven't actually cut this link - that would remove a child of the root - and instead are just doing this for accounting purposes.

Now, think about the binomial tree of order $$k+1$$ containing the tree root. Focusing purely on this tree, we'd like to remove as many nodes as possible while still leaving the root with $$k+1$$ children. Stated differently, we have a binomial tree of order $$k+1$$ and want to remove as many nodes as possible without removing any children of the root, which is exactly what the maximally damaged trees represent. So let's restructure the root's binomial tree to look like a maximally-damaged tree of order $$k+1$$, as shown here: Next, let's focus on the child subtree of order $$k+1$$. We can cut away as many nodes from this tree as we'd like, provided that we don't trigger a cascading cut that would cut this subtree from the overall order-$$k+2$$ tree root. Since this tree is allowed to lose a child without being cut from its parent, it makes sense to remove its largest child subtree, which would be its child of order $$k$$, since that would immediately eliminate the most nodes. Doing that gives us the following setup: Notice that this tree is now a binomial tree of order k and that its root has been marked.

From here, we'd like to cut away as many nodes as we possibly can. However, since the root of this subtree is now marked, we cannot cut any direct children away from the root of this subtree. If we did, that would trigger a cascading cut that would cut the whole subtree away from the global tree root, which isn't allowed. And so we're left with a smaller copy of the same problem from earlier: we have a binomial tree of order $$k$$ and we want to cut away as many nodes as possible without cutting any direct children of the root. That means we want to form a maximally-damaged tree of order $$k$$, as shown here: .

Putting everything together, we see that the shape of the overall tree can be partitioned into a maximally-damaged tree of order $$k+1$$ and a maximally-damaged tree of order $$k$$: Overall, this shows that $$MD[k+2] = MD[k] + MD[k+1]$$, which is where the Fibonacci recurrence comes in. All that's left to do is to check that the base cases satisfy $$MD = F_2$$ and $$MD = F_3$$ (they do) and we've got the bound of $$MD[k] \ge F_{k+2}$$. Tada!