H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015...

152
5.2 Fibonacci Heaps (Analysis) Frank Stajano Thomas Sauerwald Lent 2015 7 24 17 23 26 46 30 35 18 21 52 39 38 41

Transcript of H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015...

Page 1: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

5.2 Fibonacci Heaps (Analysis)Frank Stajano Thomas Sauerwald

Lent 2015

Amortized Analysis via Potential Method

INSERT: actual O(1) amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n)) amortized O(d(n))

DECREASE-KEY: actual O(# cuts) O(marks(H)) amortized O(1)

�(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

26

26

26

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps T.S. 18

Page 2: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Outline

Glimpse at the Analysis

Amortized Analysis

Bounding the Maximum Degree

5.2: Fibonacci Heaps (Analysis) T.S. 2

Page 3: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1)

amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H))

amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 4: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1)

amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H))

amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 5: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1)

amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H))

amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 6: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1)

amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H))

amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 7: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1)

amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H))

amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18

Lose

sse

cond

child C

onsolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 8: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1) amortized O(1)

X

EXTRACT-MIN: actual O(trees(H) + d(n)) amortized O(d(n))

?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H)) amortized O(1)

?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18Lo

ses

seco

ndch

ild Consolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 9: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis via Potential Method

INSERT: actual O(1) amortized O(1) X

EXTRACT-MIN: actual O(trees(H) + d(n)) amortized O(d(n)) ?

DECREASE-KEY: actual O(# cuts) ≤ O(marks(H)) amortized O(1) ?

Φ(H) = trees(H)+2·marks(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

Lifecycle of a node

18

18

18Lo

ses

seco

ndch

ild Consolidate

Loses first child

5.2: Fibonacci Heaps (Analysis) T.S. 3

Page 10: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Outline

Glimpse at the Analysis

Amortized Analysis

Bounding the Maximum Degree

5.2: Fibonacci Heaps (Analysis) T.S. 4

Page 11: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) =

trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 12: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) =

trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 13: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) =

trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 14: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) =

trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 15: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 16: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤

marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 17: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 18: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 19: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ

≤ O(x + 1) + 4− x = O(1)

Amortized Cost

Scale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 20: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ ≤ O(x + 1) + 4− x

= O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 21: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ ≤ O(x + 1) + 4− x = O(1)

Amortized CostScale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 22: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of DECREASE-KEY

DECREASE-KEY: O(x + 1), where x is the number of cuts.

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

trees(H ′) = trees(H) + x

marks(H ′) ≤ marks(H)− x + 2

⇒ ∆Φ ≤ x + 2 · (−x + 2) = 4− x .

Change in Potential

7

24

26

52

17 23

30

18

21

35

39

5

c̃i = ci + ∆Φ ≤ O(x + 1) + 4− x = O(1)

Amortized Cost

Scale up potential units

First Coin ; pays cutSecond Coin ; increase of trees(H)

5.2: Fibonacci Heaps (Analysis) T.S. 5

Page 23: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 24: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 25: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 26: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ? marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 27: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ? marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 28: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 29: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤

d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3

d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 30: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤

d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 31: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 32: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 33: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ

≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 34: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ ≤ O(trees(H) +d(n)) + d(n) + 1− trees(H)

= O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 35: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ ≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 36: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Amortized Analysis of EXTRACT-MIN

EXTRACT-MIN: O(trees(H) + d(n))

Actual Cost

Φ(H) = trees(H) + 2 ·marks(H)

marks(H ′) ≤ marks(H)

trees(H ′) ≤ d(n) + 1

⇒ ∆Φ ≤ d(n) + 1− trees(H)

Change in Potential

3

min

18 52 41

39 44

18 52 41

4439

degrees0 1 2 3 d(n)

c̃i = ci + ∆Φ ≤ O(trees(H) +d(n)) + d(n) + 1− trees(H) = O(d(n))

Amortized Cost

How to bound d(n)?

5.2: Fibonacci Heaps (Analysis) T.S. 6

Page 37: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Outline

Glimpse at the Analysis

Amortized Analysis

Bounding the Maximum Degree

5.2: Fibonacci Heaps (Analysis) T.S. 7

Page 38: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Bounding the Maximum Degree

Every tree is a binomial tree⇒ d(n) ≤ log2 n.Binomial Heap

d = 3, n = 23

Not all trees are binomial trees, but still d(n) ≤ logϕ n, where ϕ ≈ 1.62.Fibonacci Heap

5.2: Fibonacci Heaps (Analysis) T.S. 8

Page 39: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Bounding the Maximum Degree

Every tree is a binomial tree⇒ d(n) ≤ log2 n.Binomial Heap

d = 3, n = 23

Not all trees are binomial trees, but still d(n) ≤ logϕ n, where ϕ ≈ 1.62.Fibonacci Heap

5.2: Fibonacci Heaps (Analysis) T.S. 8

Page 40: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Bounding the Maximum Degree

Every tree is a binomial tree⇒ d(n) ≤ log2 n.Binomial Heap

d = 3, n = 23

Not all trees are binomial trees, but still d(n) ≤ logϕ n, where ϕ ≈ 1.62.Fibonacci Heap

5.2: Fibonacci Heaps (Analysis) T.S. 8

Page 41: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Bounding the Maximum Degree

Every tree is a binomial tree⇒ d(n) ≤ log2 n.Binomial Heap

d = 3, n = 23

Not all trees are binomial trees, but still d(n) ≤ logϕ n, where ϕ ≈ 1.62.Fibonacci Heap

5.2: Fibonacci Heaps (Analysis) T.S. 8

Page 42: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Bounding the Maximum Degree

Every tree is a binomial tree⇒ d(n) ≤ log2 n.Binomial Heap

d = 3, n = 23

Not all trees are binomial trees, but still d(n) ≤ logϕ n, where ϕ ≈ 1.62.Fibonacci Heap

5.2: Fibonacci Heaps (Analysis) T.S. 8

Page 43: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yky1 y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 44: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yky1 y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 45: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 46: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 47: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1

y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 48: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1

y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 49: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1

y2 y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 50: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2

y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 51: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2

y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 52: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2

y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 53: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2

y3 y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 54: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3

y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 55: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3

y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 56: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3

y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 57: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3

y4? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 58: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 59: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 60: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 61: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 62: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 63: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 64: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 65: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

? yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 66: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yk

y2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 67: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yk

y2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 68: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yk

y2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 69: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yk

y2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 70: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yk

y2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 71: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2

y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 72: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2

y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 73: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3

y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 74: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3

y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 75: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3 y4

yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 76: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3 y4

yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 77: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachment

and d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 78: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachmentand d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 79: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Lower Bounding Degrees of Children

d(n) ≤ logϕ n

We will prove a stronger statement:Any tree with degree k contains at least ϕk nodes.

Consider any node x of degree k (not necessarily a root) at the final state

Let y1, y2, . . . , yk be the children in the order of attachmentand d1, d2, . . . , dk be their degrees

⇒ ∀1 ≤ i ≤ k : di ≥ i − 2

x

y1 y2 y3 y4 yk

y1 y2 y3 y4

?

yky2 y3 y4 yk

5.2: Fibonacci Heaps (Analysis) T.S. 9

Page 80: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 81: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 82: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 83: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 84: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 85: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 86: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 87: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 88: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 89: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 90: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 91: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 92: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 93: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 94: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 95: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 96: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 97: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 98: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1

= 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 99: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2

= 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 100: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3

= 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 101: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5

= 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 102: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8

= 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 103: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8

= 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 104: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8

= 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 105: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8

= 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 106: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 107: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Degrees to Minimum Subtree Sizes

x

y1 y2 y3 y4 yk

∀1 ≤ i ≤ k : di ≥ i − 2

Let N(k) be the minimum possible number of nodes of a subtree rootedat a node of degree k .

Definition

N(0)

0

N(1)

1

0

N(2)

2

0 0

N(3)

3

0 0 1

0

N(4)

4

0 0 1 2

0 0 0

= 1 = 2 = 3 = 5 = 8 = 5 + 3

N(k) = F (k + 2)?

5.2: Fibonacci Heaps (Analysis) T.S. 10

Page 108: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Minimum Subtree Sizes to Fibonacci Numbers

∀1 ≤ i ≤ k : di ≥ i − 2 N(k) = F (k + 2)?

N(k) =

1

1 N(2− 2) N(3− 2) N(k − 2)

N(k) = 1 + 1 + N(2− 2) + N(3− 2) + · · ·+ N(k − 2)

= 1 + 1 +k−2∑`=0

N(`)

= 1 + 1 +k−3∑`=0

N(`) + N(k − 2)

= N(k − 1) + N(k − 2)

= F (k + 1) + F (k) = F (k + 2)

5.2: Fibonacci Heaps (Analysis) T.S. 11

Page 109: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Minimum Subtree Sizes to Fibonacci Numbers

∀1 ≤ i ≤ k : di ≥ i − 2 N(k) = F (k + 2)?

N(k) =

1

1 N(2− 2) N(3− 2) N(k − 2)

N(k) = 1 + 1 + N(2− 2) + N(3− 2) + · · ·+ N(k − 2)

= 1 + 1 +k−2∑`=0

N(`)

= 1 + 1 +k−3∑`=0

N(`) + N(k − 2)

= N(k − 1) + N(k − 2)

= F (k + 1) + F (k) = F (k + 2)

5.2: Fibonacci Heaps (Analysis) T.S. 11

Page 110: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

From Minimum Subtree Sizes to Fibonacci Numbers

∀1 ≤ i ≤ k : di ≥ i − 2 N(k) = F (k + 2)?

N(k) =

1

1 N(2− 2) N(3− 2) N(k − 2)

N(k) = 1 + 1 + N(2− 2) + N(3− 2) + · · ·+ N(k − 2)

= 1 + 1 +k−2∑`=0

N(`)

= 1 + 1 +k−3∑`=0

N(`) + N(k − 2)

= N(k − 1) + N(k − 2)

= F (k + 1) + F (k) = F (k + 2)

5.2: Fibonacci Heaps (Analysis) T.S. 11

Page 111: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1

X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 112: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1

X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 113: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1

X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 114: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1

X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 115: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 116: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2

X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 117: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 118: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) =

F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 119: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) = F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 120: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) = F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 121: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) = F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 122: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) = F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 123: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Exponential Growth of Fibonacci Numbers

For all integers k ≥ 0, the (k + 2)nd Fib. number satisfies F (k + 2) ≥ ϕk ,where ϕ = (1 +

√5)/2 = 1.61803 . . ..

Lemma 19.3

Fibonacci Numbers grow atleast exponentially fast in k .

ϕ2 = ϕ + 1

Proof by induction on k :

Base k = 0: F (2) = 1 and ϕ0 = 1 X

Base k = 1: F (3) = 2 and ϕ1 ≈ 1.619 < 2 X

Inductive Step (k ≥ 2):

F (k + 2) = F (k + 1) + F (k)

≥ ϕk−1 + ϕk−2 (by the inductive hypothesis)

= ϕk−2 · (ϕ + 1)

= ϕk−2 · ϕ2 (ϕ2 = ϕ + 1)

= ϕk

5.2: Fibonacci Heaps (Analysis) T.S. 12

Page 124: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥

N(k)

= F (k + 2) ≥ ϕk

logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 125: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥

N(k)

= F (k + 2) ≥ ϕk

logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 126: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥

N(k) = F (k + 2)

≥ ϕk

logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 127: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥

N(k) = F (k + 2) ≥ ϕk

logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 128: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥ N(k) = F (k + 2) ≥ ϕk

logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 129: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost O(d(n))

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥ N(k) = F (k + 2) ≥ ϕk

⇒ logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 130: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Putting the Pieces Together

INSERT: amortized cost O(1)

EXTRACT-MIN amortized cost�����XXXXXO(d(n)) O(log n)

DECREASE-KEY amortized cost O(1)

Amortized Analysis

n ≥ N(k) = F (k + 2) ≥ ϕk

⇒ logϕ n ≥ k

5.2: Fibonacci Heaps (Analysis) T.S. 13

Page 131: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1)

amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) 6= O(log n)

DECREASE-KEY: actual O(1)

amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 132: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1)

amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) 6= O(log n)

DECREASE-KEY: actual O(1)

amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 133: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1)

amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) 6= O(log n)

DECREASE-KEY: actual O(1)

amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 134: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1)

amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n))

amortized O(d(n)) 6= O(log n)

DECREASE-KEY: actual O(1)

amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 135: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1) amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n)) amortized O(d(n))

6= O(log n)

DECREASE-KEY: actual O(1) amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 136: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

What if we don’t have marked nodes?

INSERT: actual O(1) amortized O(1)

EXTRACT-MIN: actual O(trees(H) + d(n)) amortized O(d(n)) 6= O(log n)

DECREASE-KEY: actual O(1) amortized O(1)

Φ(H) = trees(H)

7

24 17 23

26 46 30

35

18

21

52

39

38

41

5.2: Fibonacci Heaps (Analysis) T.S. 14

Page 137: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 138: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 139: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 140: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 141: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 142: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 143: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 144: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Summary

Operation Linked list Binary heap Binomial heap Fibon. heap

MAKE-HEAP O(1) O(1) O(1) O(1)

INSERT O(1) O(log n) O(log n) O(1)

MINIMUM O(n) O(1) O(log n) O(1)

EXTRACT-MIN O(n) O(log n) O(log n) O(log n)

UNION O(n) O(n) O(log n) O(1)

DECREASE-KEY O(1) O(log n) O(log n) O(1)

DELETE O(1) O(log n) O(log n) O(log n)

DELETE = DECREASE-KEY + EXTRACT-MIN

EXTRACT-MIN = MIN + DELETE

Crucial for many applications includingshortest paths and minimum spanning trees!

Can we performEXTRACT-MIN in o(log n)?

If this was possible, then there would be asorting algorithm with runtime o(n log n)!

5.2: Fibonacci Heaps (Analysis) T.S. 15

Page 145: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 146: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 147: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 148: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 149: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 150: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Recent Studies of Fibonacci Heaps

Fibonacci Numbers were discovered >800 years ago

Fibonacci Heaps were developed by Fredman and Tarjan in 1984

Strict Fibonacci Heap:

pointer-based heap implementation similar to Fibonacci Heaps

achieves the same cost as Fibonacci Heaps, but actual costs!

Brodal, Lagogiannis, Tarjan: Strict Fibonacci Heap, (STOC’12)

Queries to marked bits are intercepted and responded with arandom bit

several lower bounds on the amortized cost in terms of the size ofthe heap and the number of operations

⇒ less efficient than the original Fibonacci heap

⇒ marked bit is not redundant!

Li, Peebles: Replacing Mark Bits with Randomness in Fibonacci Heap, (Arxive:1407.2569, 2014)

5.2: Fibonacci Heaps (Analysis) T.S. 16

Page 151: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Outlook: A More Efficient Priority Queue for fixed Universe

Operation Fibonacci heap Van Emde Boas Tree

amortized cost actual cost

INSERT O(1) O(log log u)

MINIMUM O(1) O(1)

EXTRACT-MIN O(log n) O(log log u)

MERGE/UNION O(1) -

DECREASE-KEY O(1) O(log log u)

DELETE O(log n) O(log log u)

SUCC - O(log log u)

PRED - O(log log u)

MAXIMUM - O(1)

all this requires key values to be in a universe of size u!

5.2: Fibonacci Heaps (Analysis) T.S. 17

Page 152: H)= trees H)+ ámarks H5.2 Fibonacci Heaps (Analysis) Frank StajanoThomas Sauerwald Lent 2015 Amortized Analysis via Potential Method INSERT: actual O(1) amortized O(1) EXTRACT-MIN:

Outlook: A More Efficient Priority Queue for fixed Universe

Operation Fibonacci heap Van Emde Boas Tree

amortized cost actual cost

INSERT O(1) O(log log u)

MINIMUM O(1) O(1)

EXTRACT-MIN O(log n) O(log log u)

MERGE/UNION O(1) -

DECREASE-KEY O(1) O(log log u)

DELETE O(log n) O(log log u)

SUCC - O(log log u)

PRED - O(log log u)

MAXIMUM - O(1)

all this requires key values to be in a universe of size u!

5.2: Fibonacci Heaps (Analysis) T.S. 17