Fibonacci Heap Group Paradox December 21, 2016 Contents 1. - - PowerPoint PPT Presentation

fibonacci heap
SMART_READER_LITE
LIVE PREVIEW

Fibonacci Heap Group Paradox December 21, 2016 Contents 1. - - PowerPoint PPT Presentation

Fibonacci Heap Group Paradox December 21, 2016 Contents 1. Introduction 2. Operations 3. Why it called Fibonacci (the proof) Priority Queue in Dijkstra Fibonacci Heap Operation Binary Heap Fibonacci Heap Find-Min O (1) O (1) Insert O (


slide-1
SLIDE 1

Fibonacci Heap

Group Paradox December 21, 2016

slide-2
SLIDE 2

Contents

  • 1. Introduction
  • 2. Operations
  • 3. Why it called Fibonacci (the proof)
slide-3
SLIDE 3

Priority Queue in Dijkstra

slide-4
SLIDE 4

Fibonacci Heap

Operation Binary Heap Fibonacci Heap Find-Min O(1) O(1) Insert O(lg(n)) O(1) Extract-Min O(lg(n)) O(lg(n)) Decrease-Key O(lg(n)) O(1) Merge O(n) O(1)

slide-5
SLIDE 5

Structure

root list link a bunch of trees minimum pointer

slide-6
SLIDE 6

Insert

Just add them into the root list

slide-7
SLIDE 7

Extract-Min

  • 1. extract the minimum X
  • 2. add the children of X to the root list
  • 3. consolidate (make the degree of nodes unique)
  • 4. find the new minimum
slide-8
SLIDE 8

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-9
SLIDE 9

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-10
SLIDE 10

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-11
SLIDE 11

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-12
SLIDE 12

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-13
SLIDE 13

Amortized Analysis

◮ we pay one coin for every re-link operation. ◮ a coin takes O(1) time ◮ requirement : every root has a coin ◮ deposit a coin on new node when we insert it to meet the

requirement

◮ we can use these coins during the consolidation,

so consolidation costs no new coin

◮ Extract-Min only needs at most O(max degree) coins for

re-linking children and finding new minimum

slide-14
SLIDE 14

Note that one coin takes O(1) amortized cost Operation Coin Needed at most Amortized Cost Insert 2 O(1) Extract-Min (2 + 1) · maxdegree O(lg(n))

Lemma

The maximum degree of nodes in a Fibonacci heap is O(lg(n))

slide-15
SLIDE 15

The Idea of Amortized Analysis

... ... ... ...

insert extract-min

Running Time Running Time

insert insert insert insert extract-min insert insert insert

slide-16
SLIDE 16

Decrease-Key

  • 1. cut it to the root list
  • 2. make the cascading cut
slide-17
SLIDE 17

Coin Analysis

Cut a node to root costs 2 coin, mark a node costs 2 coins. Operation Coin Needed at most Amortized Cost Insert 2 O(1) Extract-Min (2 + 1) · maxdegree O(lg(n)) Decrease-Key 4 O(1)

slide-18
SLIDE 18

Delete

  • 1. decrease it to −∞
  • 2. extract the minimum

◮ amortized cost is O(1) + O(lg(n)) = O(lg(n))

slide-19
SLIDE 19

Why it called Fibonacci

Lemma : Bounding the Maximum Degree

Let x be any node in a Fibonacci heap, and let k = x.degree. Then size(x) ≥ Fk+2

Proof

recall two lemmas about the Fibonacci number Fk+2 ≤ φk and Fk = k−2 Fi + 1 Let Sk be the possible minimum size of any nodes of degree k, we can derive Sk ≥

k−2

  • Si + 1

thus, Sk ≥ Fk+2

slide-20
SLIDE 20

Why it called Fibonacci

Lemma : Bounding the Maximum Degree

Let x be any node in a Fibonacci heap, and let k = x.degree. Then size(x) ≥ Fk+2

Proof

recall two lemmas about the Fibonacci number Fk+2 ≤ φk and Fk = k−2 Fi + 1 Let Sk be the possible minimum size of any nodes of degree k, we can derive Sk ≥

k−2

  • Si + 1

thus, Sk ≥ Fk+2

slide-21
SLIDE 21

Why it called Fibonacci

Lemma : Bounding the Maximum Degree

Let x be any node in a Fibonacci heap, and let k = x.degree. Then size(x) ≥ Fk+2

Proof

recall two lemmas about the Fibonacci number Fk+2 ≤ φk and Fk = k−2 Fi + 1 Let Sk be the possible minimum size of any nodes of degree k, we can derive Sk ≥

k−2

  • Si + 1

thus, Sk ≥ Fk+2