Fibonacci Heaps
Group: N = NP Leader: T ang Hao Member: Chen Zhiqin Liao Mingding Shen Bingyu
Fibonacci Heaps Group: N = NP Leader: T ang Hao Member: Chen - - PowerPoint PPT Presentation
Fibonacci Heaps Group: N = NP Leader: T ang Hao Member: Chen Zhiqin Liao Mingding Shen Bingyu Introduction Binominal Heap Fibonacci Heap a better amortized running time than a binomial heap developed by Michael L. Fredman and
Group: N = NP Leader: T ang Hao Member: Chen Zhiqin Liao Mingding Shen Bingyu
– a better amortized running time than a binomial heap – developed by Michael L. Fredman and Robert E. Tarjan in 1984 – first published in a scientific journal in 1987 – The name of Fibonacci heap comes from Fibonacci numbers whic h are used in the running time analysis
Using Fibonacci Heaps, the total running time of Dij kstra or Prim is O(m + n log n) A faster implementation of Prim’s MST algorithm and Dijkstra’s Shortest Paths algorithm.
Operation running time using times insert(v, h) O(1) |V| delete- min(h) O(log n) |V| decrease(v, Δ) O(1) m(edges)
Binomial Trees are defined inductively.
Proposition 1 Two trees Bk can be merged into
e operation. Proof.
A collection of Binomial trees. For each rank k, at most one tree Bk is containe d. Each of the trees satisfy the heap property.
niverse) contains at most O(log n) trees.
Our goal is to implement the insert operation in time O(1).
Operation
insert(v, h) O(log n) O(1) delete-min(h) O(log n) O(log n) decrease(v, Δ) O(log n) O(1)
1 Credit 1 Credit 1 + 1 – 1 = 1 Credit
Push off the meld operation from insert to delete_min. Merge credit: one unit operation to merge two trees together, it tak
es O(1) time.
Insert: each tree is given on merge credit. So the insert operation do
es one insert operation and one merge credit.
Delete_min: we first meld the trees together. When two trees merged to
gether to one tree, we use one merge credit, and the result is one new tree with one merge credit. So meld is free. Delete_min only cost O(max deg) to search all the trees and O(deg(min)) to put its sons into the root list.
decrease 23 to 3
Decrease 42 to 2
If we decrease the value for some node v:
Cut this node !
1 cut credit 1 merge credit 1 merge credit
1 cut credit 1 merge credit 1 merge credit
2 cut credit 2 merge credit 1 merge credit 1 merge credit
2 cut credit 2 merge credit 1 merge credit 1 merge credit
1 cut credit 1 merge credit 1 merge credit 1 merge credit 1 merge credit
Cut credit: one unit operation to cut one subtree, it takes O (1) time. decrease: the decrease function cuts the subtree, give the n ew tree one merge credit and give the parent of the node one merge credit and one cut credit. It takes O(1) time. Iteration cut: if the nodes has lost two children, it will contain two merge credits and two cut credits. Use one cut credit to cut the subtree, give one merge credit to the new tree, give o ne merge credit and one cut credit to the parent of it. Then t he iteration cut is free.
Sk: The smallest number of nodes that could be in a t ree of rank k.
Sk = 1 + S0 + S0 + S1 + S2 + . . . + Sk 3 + Sk 2 − − Sk 1 = 1 + S0 + S0 + S1 + S2 + . . . + Sk 4 + Sk 3 − − −
Sk Sk 1 = Sk 2 − − − Fibonacci numbers
1 S S S 1 S 2 S 3 S 4
After the clean-up operation, the delete_min operati
erminates in O(log n) steps. the operations in Prim’s or Dijkstra’s algorithm take time O(m + n + n log n) = O(m + n log n).
1. https://en.wikipedia.org/wiki/Fibonacci_heap 2. https://en.wikipedia.org/wiki/Binomial_heap 3. Thomas H.; Leiserson, Charles E., Rivest, Ronald L. (1990). Introduction to Algorith ms (1st ed.). MIT Press and McGraw-Hill. ISBN 0-262-03141-8. 4. http://www.cnblogs.com/skywang12345/p/3659060.html 5. http://www-bcf.usc.edu/~dkempe/teaching/fibonacci.pdf