Presentation is loading. Please wait.

Presentation is loading. Please wait.

Prioritetskøer med Afskæring Rajamani Sundar, Worst-case data structures for the priority queue with attrition, Information Processing Letters, 31(2),

Similar presentations


Presentation on theme: "Prioritetskøer med Afskæring Rajamani Sundar, Worst-case data structures for the priority queue with attrition, Information Processing Letters, 31(2),"— Presentation transcript:

1 Prioritetskøer med Afskæring Rajamani Sundar, Worst-case data structures for the priority queue with attrition, Information Processing Letters, 31(2), 69-75, 1989.

2 Operationer CreateS := Ø Insert(x)S := { x } ᴜ { y  S | y < x } Deleteminm := min(S); S := S \ { m }; return m

3 Løsning: Sorteret Liste CreateS := () Insert(x)while (|S|>0 and tail(S)≥x) remove_tail(S) insert_tail(x) Deletemin return remove_head(S)

4 Løsning: Sorteret Liste CreateS := () Insert(x)while (|S|>0 and tail(S)≥x) remove_tail(S) insert_tail(x) Deletemin return remove_head(S) Sætning Create, Insert og DeleteMin tager amortiseret O(1) tid Bevis: Φ(S) = |S|.□

5 Worst-Case O(1)

6 CBDfDf DrDr Invarianter 1)C, B, D f sorterede 2)max C ≤ min (B ᴜ D f ᴜ D r ) 3)|C|≥ |D f |+2|D r | 17 ≥ 4+2∙5 Løsning: 4 Lister indsættelsestidspunkt

7 CBDfDf DrDr Invarianter 1)C, B, D f sorterede 2)max C ≤ min (B ᴜ D f ᴜ D r ) 3)|C|≥ |D f |+2|D r | B IAS ≥ “+1”

8 D f +1, D r -1 B D f -1 A C C=C+D f, B=D f =0 D C +1, B -1 Invarianter 1)C, B, D f sorterede 2)max C ≤ min (B ᴜ D f ᴜ D r ) 3)|C|≥ |D f |+2|D r | B IAS ≥ “+1” A B C D CBDfDf DrDr CBDfDf DrDr CBDfDf DrDr CBDfDf DrDr

9 Sætning Create, Insert og DeleteMin tager worst-case O(1) tid CBDfDf DrDr Invarianter 1)C, B, D f sorterede 2)max C ≤ min (B ᴜ D f ᴜ D r ) 3)|C|≥ |D f |+2|D r |


Download ppt "Prioritetskøer med Afskæring Rajamani Sundar, Worst-case data structures for the priority queue with attrition, Information Processing Letters, 31(2),"

Similar presentations


Ads by Google