Skip to content

Commit f914780

Browse files
📚 docs(manual): Improve Theory section.
1 parent 8bf0538 commit f914780

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

doc/manual/theory.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Theory
22

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
44
amortized constant time.
55

66
> 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`.
2727
Let `D(H)` denote the maximum degree of a node in `H`, then the real cost,
2828
potential change, and amortized cost of the heap operations are respectively:
2929

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))`
3535

3636
Where `c` in DECREASE-KEY can be has large as the height of the tallest tree in
3737
our collection.
@@ -51,17 +51,17 @@ therefore i-1.
5151

5252
Whenever a child is removed from a parent (cut), one of two things happens:
5353

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.
5656

5757
This guarantees that the degree of the ith child of a parent is at least i - 2.
5858

5959
It can then be proven that the size of any node x of degree k is
6060
`size(x) >= F_{k+2} >= phi^k` where `F_i` is the ith Fibonacci number.
6161

62-
*Hint: `F_{k+2} = 1 + F_0 + F_1 + ... + F_k`.*
62+
> Hint: `F_{k+2} = 1 + F_0 + F_1 + ... + F_k`.
6363
64-
#### Problems
64+
#### Problems (with solutions)
6565

6666
We may have to cut repeatedly if a chain of ancestors is marked when we cut a
6767
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
132132
root list. We do so by making sure there is at most one node of each degree in
133133
the root list. We call this procedure CONSOLIDATE. Once that procedure is
134134
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)),
136136
the same as updating the minimum.
137137

138138
> There are at most `D(H) + 1` left in the root list after this procedure is

0 commit comments

Comments
 (0)