This preview shows pages 1–7. Sign up to view the full content.
Fibonacci Heaps
CLRS: Chapter 20
Last Revision: 21/09/04
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document Binary heap
Binomial heap Fibonacci heap
Procedure
(worstcase) (worstcase)
(amortized)
MakeHeap
Θ(1)
Θ(1)
Θ(1)
Insert
Θ(lg
n
)
O
(lg
n
)
Θ(1)
Minimum
Θ(1)
O
(lg
n
)
Θ(1)
ExtractMin
Θ(lg
n
)
Θ(lg
n
)
O
(lg
n
)
Union
Θ(
n
)
O
(lg
n
)
Θ(1)
DecreaseKey
Θ(lg
n
)
Θ(lg
n
)
Θ(1)
Delete
Θ(lg
n
)
Θ(lg
n
)
O
(lg
n
)
So far we have seen
Binomial heaps
and learnt some
techniques for performing
amortized analysis
.
In this section we will design
Fibonacci heaps
, whose
running times will be
amortized
and not worst case.
Even with only amortized running times, Fibonacci heaps
provide enough of an improvement to reduce the run
time of
Dijkstra’s
and
Prim’s
algorithms from
(

V

+

E

)log

V

down to

V

log

V

+

E

.
Our amortized analysis will use the
Potential method.
2
Fibonacci heaps
, like
Binomial heaps
, are a
collection
of heapordered trees.
Some properties
•
nodes in a F.H are
not
ordered (by degree) in the
root list or as siblings.
•
(root and sibling) lists kept as
circularlylinked
lists.
Allows constant time deletion/insertion/concatenation.
•
Each node stores its
degree
(number of children).
•
min
[
H
]
is a pointer to minimum root in root list.
•
N
(
H
)
keeps
number
of nodes currently in
H
.
3
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 23
7
18
3
39
52
38
41
17
30
26
24
35
46
min[H]
Marked Nodes:
Some nodes will be
marked
(indicated by the
marked
bit set to
1
).
(i) A node
x
will be marked if
x
has lost a child since
the last time that
x
was made a child of another node.
(ii) Newly created nodes are unmarked
(iii) When node
x
becomes child of another node it
becomes unmarked.
Potential Function:
The
potential
of
H
will be
t
(
H
)
,
the number of nodes
in root list of
H
plus two times
m
(
H
)
, the number of
marked nodes
.
Φ(
H
) =
t
(
H
) + 2
m
(
H
)
.
In example above
Φ(
H
) = 5 + 2
·
3 = 11
.
4
23
7
18
3
39
52
38
41
17
30
26
24
35
46
min[H]
Assumption:
There is a maximum degree
D
(
n
)
on
the degree of any node in an
n
node Fibonacci heap.
We will prove later that
D
(
n
) =
O
(log
n
)
.
5
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
7
18
3
39
52
38
41
17
30
26
24
35
46
min[H]
MakeHeap():
This is a very easy
O
(1)
(both amortized and actual)
operation.
Minimum(
H
):
Return the node pointed to by
min
[
H
]
.
This takes
O
(1)
actual time.
The heap does not change before and after this oper
ation so difference in potential is
0
.
Amortized cost is then also
O
(1)
.
6
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 04/09/2010 for the course CS 12345 taught by Professor Thomas during the Spring '10 term at École Normale Supérieure.
 Spring '10
 Thomas
 Algorithms

Click to edit the document details