day 9: 2/9/98 ``This is a big mess.''
Make a singleton tree then meld it with the tree you wish to insert into. This is amortized O(1) .
Relax the restriction that there be only one tree of a particular Bi . Concatenate 2 lists of trees in the meld, updating the min pointer to the min of each heap.
Just follow the min pointer through the heap
Remove some root and consider each subtree a tree. It will be necessary to inspect all trees to find the new min pointer. Might as well do real melds at the same time. O(log(n)) .
Fibonacci heaps are binomial heaps with these exceptions:
To decrement, promote nodes to the top level and decrement most of the time.
decrement(h,x,D)
cascade-cut(y)
cut(y)
let f = a potential function = # of trees + 2 * # of marks.
Hmm.. These notes are indecipherable. I'll grab some stuff from a book of mine. ``Algorithms from P to NP'' by Moret and Shapiro. This is pretty much verbatim.
Let x be any node in a Fibonacci heap and let the current children of x be orderd from ealiest to latest according to the time at whichc they were linked to x. Then the rank of the ith child is at least i-2 . rank(y) ³ i-2 where y = i'th child of x
When y was linked to x, x must alread have had at least i-1 children, because children could since have disappeared (due to cuts), but any children added subsequently would be farther down in the order. Since x and y were linked, they had the same rank at that time, so that y itself had at least i-1 children. Since y has not been cut, it can have lost at most one child since that time and hence still has at least i-2 children.
A node of ranke k in a fibonacci heap has at least Fk+2 descendents where Fk is the k th fibonacci number.
Let Sk be the size of the smallest possible subtree in any Fibonacci heap such that its root has rank k . We claim that we have Sk = Fk+2 . We have S0 = 1 and S1 = 2 . The preceeding lemma gives the recurrence Sk ³ åi = 2kSi-2+2 . The inequality is exact because Sk was was specified to be minimal and such a tree does exist, giving: Sk = Sk-1+Sk-2 . This implies Sk = Fk+2 .