5.2 Fibonacci Heaps (Analysis) Frank Stajano Thomas Sauerwald

5.2 Fibonacci Heaps (Analysis) Frank Stajano Thomas Sauerwald

Amortized Analysis via Potential Method INSERT: actual (1) amortized (1) O O X EXTRACT-MIN: actual (trees(H)+d(n)) amortized (d(n)) ? O O DECREASE-KEY: actual (# cuts) (marks(H)) amortized (1) ? O O O Φ(H)=trees(H)+2 marks(H) · Lifecycle of a node 7 18 38 18 Consolidate 24 17 23 21 39 41 Loses second child 26 46 30 52 18 18 35 Loses first child 5.2: Fibonacci Heaps (Analysis) T.S. 3 5.2 Fibonacci Heaps (Analysis) Frank Stajano Thomas Sauerwald Lent 2016 Outline Recap of INSERT,EXTRACT-MIN and DECREASE-KEY Glimpse at the Analysis Amortized Analysis Bounding the Maximum Degree 5.2: Fibonacci Heaps (Analysis) T.S. 2 and update min-pointer (if necessary) Create a singleton tree Add to root list 21 Actual Costs: (1) min O 21 Fibonacci Heap: INSERT INSERT 21 17 24 23 7 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 and update min-pointer (if necessary) Add to root list 21 Actual Costs: (1) min O 21 Fibonacci Heap: INSERT INSERT Create a singleton tree 21 17 24 23 7 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 and update min-pointer (if necessary) 21 Actual Costs: (1) min O Fibonacci Heap: INSERT INSERT Create a singleton tree Add to root list 21 17 24 23 7 21 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 and update min-pointer (if necessary) 21 Actual Costs: (1) min O Fibonacci Heap: INSERT INSERT Create a singleton tree Add to root list 21 17 24 23 7 21 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 21 Actual Costs: (1) O Fibonacci Heap: INSERT INSERT Create a singleton tree Add to root list and update min-pointer (if necessary) 21 min 17 24 23 7 21 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 21 Fibonacci Heap: INSERT INSERT Create a singleton tree Add to root list and update min-pointer (if necessary) 21 Actual Costs: (1) min O 17 24 23 7 21 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 13 + d(n) X X (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 Delete min Meld childen into root list and unmark them Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min 1 degree=22 0 degree=00 1 0 1 17 18 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN min 7 24 23 17 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) X (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 X Meld childen into root list and unmark them Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min 1 degree=22 0 degree=00 1 0 1 17 18 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min min 7 24 23 17 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) X (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 Meld childen into root list and unmark them Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 18 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X 7 24 23 17 3 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 X Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 183 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them 7 24 23 17 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 X Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 183 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them 7 24 23 17 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O 41 44 X Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 183 52 17 24 23 41 39 23 26 46 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them 7 24 23 17 30 26 46 18 52 41 35 39 44 5.2: Fibonacci Heaps T.S. 14 + d(n) (# children) X X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O Consolidate so that no roots have the same degree Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 3 17 24 23 41 18 52 41 23 26 46 44 39 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them X 7 24 23 17 18 52 41 30 26 46 39 44 35 5.2: Fibonacci Heaps T.S. 14 + d(n) X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O (# children) X Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 3 17 24 23 41 18 52 41 23 26 46 44 39 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them X Consolidate so that no roots have the same degree 7 24 23 17 18 52 41 30 26 46 39 44 35 5.2: Fibonacci Heaps T.S. 14 + d(n) X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O X Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 3 17 24 23 41 18 52 41 23 26 46 44 39 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them X Consolidate so that no roots have the same degree (# children) 7 24 23 17 18 52 41 30 26 46 39 44 35 5.2: Fibonacci Heaps T.S. 14 + d(n) X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O X Update minimum degree 0 1 2 3 Actual Costs: min min 1 2 0 degree=00 1 0 1 17 3 17 24 23 41 18 52 41 23 26 46 44 39 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them X Consolidate so that no roots have the same degree (# children) degree=2 7 24 23 17 18 52 41 30 26 46 39 44 35 5.2: Fibonacci Heaps T.S. 14 + d(n) X Every root becomes child of d(n) is the maximum degree of a another root at most once! root in any Fibonacci heap of size n (trees(H) ) O X Update minimum degree 0 1 2 3 Actual Costs: min min 1 degree=22 0 degree=00 1 0 1 17 3 17 24 23 41 18 52 41 23 26 46 44 39 44 35 Fibonacci Heap: EXTRACT-MIN EXTRACT-MIN Delete min X Meld childen into root list and unmark them X Consolidate so that no roots have the same degree (# children) 7 24 23 17 18 52 41 30 26 46 39 44 35 5.2: Fibonacci Heaps T.S.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    234 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us