Fibonacci Heaps 1
Fibonacci Heaps 1
Fibonacci Heaps
• Like a binomial heap, a Fibonacci heap is a collection of min-
heap-ordered trees.
• The trees in a Fibonacci heap are not constrained to be
binomial trees.
• Unlike trees within binomial heaps, which are ordered, trees
within Fibonacci heaps are rooted but unordered.
Fibonacci Heaps
• each node x contains a pointer p[x] to its parent and a pointer
child[x] to any one of its children.
• The children of x are linked together in a circular, doubly
linked list, which we call the child list of x.
• Each child y in a child list has pointers left[y] and right[y] that
point to y’s left and right siblings, respectively.
Fibonacci Heaps
• If node y is an only child, then left[y] = right[y] = y.
• The order in which siblings appear in a child list is arbitrary.
• The number of children in the child list of node x is stored in
degree[x].
• The boolean-valued field mark[x] indicates whether node x
has lost a child since the last time x was made the child of
another node.
• Newly created nodes are unmarked, and a node x becomes
unmarked whenever it is made the child of another node.
• A given Fibonacci heap H is accessed by a pointer min[H] to
the root of a tree containing a minimum key; this node is
called the minimum node of the Fibonacci heap.
• If a Fibonacci heap H is empty, then min[H] = NIL.
• The roots of all the trees in a Fibonacci heap are linked
together using their left and right pointers into a circular,
doubly linked list called the root list of the Fibonacci heap.
Fibonacci Heaps: Structure of a node
n[H] = 14
30 26 46
t(H) = 5 18 52 41
m(H) = 3
35
H 39 44
Maximum Degree
• FIB-HEAP-LINK (H, y, x)
Linking step x
y x
y
Assume x y
(a) The node with key 46 has its key decreased to 15. The node becomes a
root, and its parent (with key 24), which had previously been unmarked,
becomes marked.
Decreasing a key: Example