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

## 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:

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.

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

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)

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|.□

Worst-Case O(1)

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

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” 1 2 3 3 2 1

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

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