1
1
# Theory
2
2
3
- The Fibonacci heaps guarantees that decrease-key operations can be executed in
3
+ The Fibonacci heap guarantees that decrease-key operations can be executed in
4
4
amortized constant time.
5
5
6
6
> The Fibonacci heap is of interest only if the user needs the decrease-key
@@ -27,11 +27,11 @@ of the root list of `H` and `M(H)` is the number of marked nodes of `H`.
27
27
Let ` D(H) ` denote the maximum degree of a node in ` H ` , then the real cost,
28
28
potential change, and amortized cost of the heap operations are respectively:
29
29
30
- - MAKE-HEAP: ` O(1) ` , ` 0 ` , ` O(1) ` .
31
- - INSERT: ` O(1) ` , ` 1 ` , ` O(1) ` .
32
- - MELD: ` O(1) ` , ` 0 ` , ` O(1) `
33
- - DECREASE-KEY: ` O(c) ` , ` 2-c ` , ` O(1) `
34
- - DELETE-MIN: ` O(R(H) + D(H)) ` , ` O(1)-R(H) ` ,` O(D(H)) `
30
+ - [ MAKE-HEAP] ( #make-heap ) : ` O(1) ` , ` 0 ` , ` O(1) ` .
31
+ - [ INSERT] ( #insert ) : ` O(1) ` , ` 1 ` , ` O(1) ` .
32
+ - [ MELD] ( #meld ) : ` O(1) ` , ` 0 ` , ` O(1) `
33
+ - [ DECREASE-KEY] ( #decrease-key ) : ` O(c) ` , ` 2-c ` , ` O(1) `
34
+ - [ DELETE-MIN] ( #delete-min ) : ` O(R(H) + D(H)) ` , ` O(1)-R(H) ` ,` O(D(H)) `
35
35
36
36
Where ` c ` in DECREASE-KEY can be has large as the height of the tallest tree in
37
37
our collection.
@@ -51,17 +51,17 @@ therefore i-1.
51
51
52
52
Whenever a child is removed from a parent (cut), one of two things happens:
53
53
54
- - if the parent is marked, we cut it.
55
- - if the parent is not marked, we mark it.
54
+ 1 . If the parent is marked, we cut it.
55
+ 2 . If the parent is not marked, we mark it.
56
56
57
57
This guarantees that the degree of the ith child of a parent is at least i - 2.
58
58
59
59
It can then be proven that the size of any node x of degree k is
60
60
` size(x) >= F_{k+2} >= phi^k ` where ` F_i ` is the ith Fibonacci number.
61
61
62
- * Hint: ` F_{k+2} = 1 + F_0 + F_1 + ... + F_k ` .*
62
+ > Hint: ` F_{k+2} = 1 + F_0 + F_1 + ... + F_k ` .
63
63
64
- #### Problems
64
+ #### Problems (with solutions)
65
65
66
66
We may have to cut repeatedly if a chain of ancestors is marked when we cut a
67
67
node. We can amortize this cost because each cut ancestors can be unmarked.
@@ -132,7 +132,7 @@ To amortize this costly operation, we need to reduce the number of nodes in the
132
132
root list. We do so by making sure there is at most one node of each degree in
133
133
the root list. We call this procedure CONSOLIDATE. Once that procedure is
134
134
finished, there are at most ` D(H) + 1 ` nodes left in the root list. The real
135
- cost of the procedure is proportional to ` R(H) + D(H) ` (see [ below] ( #CONSOLIDATE ) ),
135
+ cost of the procedure is proportional to ` R(H) + D(H) ` (see [ below] ( #consolidate ) ),
136
136
the same as updating the minimum.
137
137
138
138
> There are at most ` D(H) + 1 ` left in the root list after this procedure is
0 commit comments