On the power of structural violations in priority queues Jyrki - - PowerPoint PPT Presentation

on the power of structural violations in priority queues
SMART_READER_LITE
LIVE PREVIEW

On the power of structural violations in priority queues Jyrki - - PowerPoint PPT Presentation

On the power of structural violations in priority queues Jyrki Katajainen (University of Copenhagen) Joint work with Amr Elmasry (Alexandria University) and Claus Jensen (University of Copenhagen) These slides are available at


slide-1
SLIDE 1

c

Performance Engineering Laboratory

CATS 2007 (1)

On the power of structural violations in priority queues

Jyrki Katajainen (University of Copenhagen) Joint work with Amr Elmasry (Alexandria University) and Claus Jensen (University of Copenhagen)

These slides are available at http://www.cphstl.dk

slide-2
SLIDE 2

c

Performance Engineering Laboratory

CATS 2007 (2)

Heaps

8

find-min() insert() extract() decrease(→6) delete()

4 1 5 7

Examples: Fibonacci heaps Run-relaxed heaps Fat heaps

slide-3
SLIDE 3

c

Performance Engineering Laboratory

CATS 2007 (3)

Focus

  • comparison complexity of heap operations
  • worst-case efficiency
  • constant factors

Our ultimate goal is to develop a library component that guarantees

  • ptimal complexity bounds, but unfortunately the data structures de-

veloped are not practical.

slide-4
SLIDE 4

c

Performance Engineering Laboratory

CATS 2007 (4)

Research question

Q: If find-min, insert, extract, and decrease are required to take O(1) time, can delete be realized in O(lg n) time including only lg n+O(1) element comparisons. A: If decrease is allowed to take O(lg n) time, yes. With O(1)-time

decrease almost, but we do not know the final answer.

n: # elements stored just prior to an operation

slide-5
SLIDE 5

c

Performance Engineering Laboratory

CATS 2007 (5)

Binomial heaps

min

3 1 y x

n = 1010two B3 B1 Bk−1 Bk−1 B0 ≡ Bk ≡

  • heap-ordered x ≤ y
  • at most ⌊lg n⌋ + 1 binomial trees

Read [Cormen et al. 2001]

slide-6
SLIDE 6

c

Performance Engineering Laboratory

CATS 2007 (6)

Heap-order violations

1 9

binomial heaps

O(lg n) violations run-relaxed heaps [Driscoll et al. 1988]

slide-7
SLIDE 7

c

Performance Engineering Laboratory

CATS 2007 (7)

Structural violations

phantom node a subtree missing

Example: Fibonacci heaps [Fredman & Tarjan 1987]

slide-8
SLIDE 8

c

Performance Engineering Laboratory

CATS 2007 (8)

Pruned heaps

τ: # of trees λ: # of phantom nodes τ ≤ O(lg n) λ ≤ O(lg n)

r

phantom node

slide-9
SLIDE 9

c

Performance Engineering Laboratory

CATS 2007 (9)

Results

◗◗◗◗◗◗◗◗◗◗ ◗

Heap Oper- ation Run-relaxed heaps [ISAAC 2006] Fat heaps Two-tier relaxed heaps [ISAAC 2006] Two-tier pruned heaps [this paper]

find-min

O(1) O(1) O(1) O(1)

insert

O(1) O(1) O(1) O(1)

extract

O(1) – O(1) O(1)

decrease

O(1) O(1) O(1) O(1)

delete

3 lg n+O(1) 2.73 lg n+O(1) lg n+O(lg lg n) lg n+O(√lg n) # of element comparisons

slide-10
SLIDE 10

c

Performance Engineering Laboratory

CATS 2007 (10)

Find-min

Maintain a pointer to the current minimum

min

slide-11
SLIDE 11

c

Performance Engineering Laboratory

CATS 2007 (11)

Insert

Imitate ++ for binary numbers 1 1 1 + 1 1

+ =

slide-12
SLIDE 12

c

Performance Engineering Laboratory

CATS 2007 (12)

Extract

Imitate -- for binary numbers 1

  • 1

1 1 1

⇒ extract

extract is our contribution for the mankind!

slide-13
SLIDE 13

c

Performance Engineering Laboratory

CATS 2007 (13)

Problem

carries/borrows

Use redundant zeroless number representation

1000two

32redundant-four

[ISAAC 2006]

slide-14
SLIDE 14

c

Performance Engineering Laboratory

CATS 2007 (14)

Decrease

  • cut the subtree T
  • put a phantom node instead
  • make the element replacement
  • see T as a separate tree
  • reduce the # of phantom nodes if

necessary

8

T

→6

slide-15
SLIDE 15

c

Performance Engineering Laboratory

CATS 2007 (15)

+ 4 other transformations, see the proceedings

Data-structural transformations

Singleton transformation I: Both x and y are the last children of their parents p and q, respectively. Name the nodes such that

element[p] > element[q].

f p Bk x Bk g q Bk y Bk

f p Bk q Bk g Bk+1

slide-16
SLIDE 16

c

Performance Engineering Laboratory

CATS 2007 (16)

Delete

  • cut the subtree T rooted at x
  • replace with a phantom node
  • remove x
  • extract a node y
  • join the subtrees of T and y
  • make the new tree as a separate

tree

  • update the minimum pointer if ne-

cessary

  • reduce the # of phantom nodes

if necessary

delete

T

extract

x y

slide-17
SLIDE 17

c

Performance Engineering Laboratory

CATS 2007 (17)

Analysis

Theorem: A node can have at most lg n + O(√lg n) real children For a proof, see the proceedings ⇒ delete performs at most 2 lg n + O(√lg n) element comparisons

slide-18
SLIDE 18

c

Performance Engineering Laboratory

CATS 2007 (18)

Two-tier heaps

lower store pointers elements upper store lazy deletions!

slide-19
SLIDE 19

c

Performance Engineering Laboratory

CATS 2007 (19)

Mimicking heap-order violations

heap-order violation

x

structural violation

r

phantom node shadow structure x

y r

main structure

r

slide-20
SLIDE 20

c

Performance Engineering Laboratory

CATS 2007 (20)

Main contribution

Theorem: Relaxed heaps (heap-order violations) and pruned heaps (structural violations) are equal in power up to lg n + O(lg lg n) element comparisons per delete

slide-21
SLIDE 21

c

Performance Engineering Laboratory

CATS 2007 (21)

Open problems

  • What is the answer to our original research question, i.e. is lg n +

O(1) element comparisons per delete() possible or not?

  • Are the two types of violations in 1-1 correspondence or not?
  • What is the lowest number of element comparisons performed by

delete for heaps that are efficiently meldable?

  • How to implement a worst-case efficient heap in an industry-

strength program library?