Fibonacci Heaps - Advanced Data Structures - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Advanced Data Structures which includes Split Algorithm, Unbalanced Binary Search Trees, Forward Pass, Forward Pass Example, Backward Cleanup Pass, Retrace Path, Current Nodes, Roots of Respective Tries, Branch Nodes etc. Key important points are: Fibonacci Heaps, Destinations Shortest Paths, Dijkstra’s Algorithm, Overall Complexity, Number of Vertices, Number of Edges, Min-Cost Spanning Tree Algorithm, Collection of Min Trees

Typology: Slides

2012/2013

Uploaded on 03/19/2013

dharmakeerti
dharmakeerti 🇮🇳

4.2

(27)

89 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Fibonacci Heaps
Actual
Amortized
Insert O(1) O(1)
Remove min (or max)
O(n) O(log n)
Meld O(1) O(1)
Remove O(n) O(log n)
Decrease key (or
increase) O(n) O(1)
Single Source All Destinations
Shortest Paths
1
2
3
4
5
6
7
2
616 7
8
10
3
14
44
5 3
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Fibonacci Heaps - Advanced Data Structures - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Fibonacci Heaps

Actual Amortized

Insert O(1) O(1)

Remove min (or max) O(n) O(log n)

Meld O(1) O(1)

Remove O(n) O(log n)

Decrease key (or

increase)

O(n) O(1)

Single Source All Destinations

Shortest Paths

Greedy Single Source All Destinations

• Known as Dijkstra’s algorithm.

• Let d(i) be the length of a shortest one edge

extension of an already generated shortest path,

the one edge extension ends at vertex i.

• The next shortest path is to an as yet unreached

vertex for which the d() value is least.

• After the next shortest path is generated, some

d() values are updated (decreased).

Operations On d()

• Remove min.

ƒ Done O(n) times, where n is the number of vertices in

the graph.

• Decrease d().

ƒ Done O(e) times, where e is the number of edges in

the graph.

• Array.

ƒ O(n^2 ) overall complexity.

• Min heap.

ƒ O(nlog n + elog n) overall complexity.

• Fibonacci heap.

ƒ O(nlog n + e) overall complexity.

Node Structure

• Degree, Child, Data

• Left and Right Sibling

ƒ Used for circular doubly linked list of siblings.

• Parent

ƒ Pointer to parent node.

• ChildCut

ƒ True if node has lost a child since it became a child

of its current parent.

ƒ Set to false by remove min, which is the only

operation that makes one node a child of another.

ƒ Undefined for a root node.

Fibonacci Heap Representation

• Degree, Parent and ChildCut fields not shown.

A

Remove(theNode)

• theNode points to the Fibonacci heap node

that contains the element that is to be

removed.

• theNode points to min element => do a

remove min.

ƒ In this case, complexity is the same as that for

remove min.

Remove(theNode)

• theNode points to an element other than the min

element.

ƒ Remove theNode from its doubly linked sibling list.

ƒ If sibling list becomes empty, make parent’s child pointer

null.

ƒ Set parent field of theNode’s children to null.

ƒ Combine top-level list and children list of theNode; do not

pairwise combine equal degree trees.

ƒ Free theNode.

• In this case, actual complexity is O(log n) (assuming

theNode has O(log n) children).

Remove(theNode)

DecreaseKey(theNode, theAmount)

If theNode is not a root and new key < parent

key, remove subtree rooted at theNode from its

doubly linked sibling list.

Insert into top-level list.

theNode

DecreaseKey(theNode, theAmount)

Update heap pointer if necessary

Cascading Cut

• When theNode is cut out of its sibling list in a

remove or decrease key operation, follow path

from parent of theNode to the root.

• Encountered nodes (other than root) with

ChildCut = true are cut from their sibling lists

and inserted into top-level list.

• Stop at first node with ChildCut = false.

• For this node, set ChildCut = true.

Cascading Cut Example

T

F

Cascading Cut Example

F 9 8

Cascading Cut Example

T 9 8

Actual complexity of cascading cut is O(h) = O(n).