Is it possible for a Fibonacci heap to contain a tree that isn’t a binomial tree? If so, how would this happen? Can you give an example?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, this can happen. Intuitively, the reason is that in a Fibonacci heap, the decrease-key operation can work by cutting a subtree from a larger tree, resulting in two trees that are (potentially) not binomial trees. This differs from the binomial heap, where decrease-key works by doing a bubble-up operation from the node whose key was decreased all the way up to the root.
To see a concrete example, let’s insert five elements into a Fibonacci heap, say, 1, 3, 5, 7, and 9. This gives the heap
Now, let’s do a dequeue-min, which extracts 1. We now try to compact all of the remaining elements together, which merges the trees as follows:
Now, suppose that we do a decrease-key operation on to decrease the key of 9 to 6. To do this, we cut 9 from its parent and merge it into the list of trees at the top, which yields
And now the tree with 3 at its root contains only 3 elements, so it is not a binomial tree anymore.
Hope this helps!