W orst Case Ecien t Data Structures Gerth Stlting Bro dal - - PowerPoint PPT Presentation

w orst case e cien t data structures gerth st lting bro
SMART_READER_LITE
LIVE PREVIEW

W orst Case Ecien t Data Structures Gerth Stlting Bro dal - - PowerPoint PPT Presentation

W orst Case Ecien t Data Structures Gerth Stlting Bro dal BRICS Departmen t of Computer Science Univ ersit y of Aarh us and MaxPlanc kInstitut f ur Informatik Saarbr uc k en Ov erview


slide-1
SLIDE 1 W
  • rst
Case Ecien t Data Structures Gerth Stlting Bro dal BRICS Departmen t
  • f
Computer Science Univ ersit y
  • f
Aarh us and MaxPlanc kInstitut f
  • ur
Informatik Saarbr
  • uc
k en
slide-2
SLIDE 2 Ov erview
  • Priorit
y queues
  • Comparison
based data structures
  • Lo
w er b
  • unds
for comparison based data structures
  • RAM
data structures
  • P
arallel data structures
  • P
artial p ersisten t data structures G S Bro dal W
  • rst
case ecien t data structures
slide-3
SLIDE 3 Priorit y Queues Main tain a set
  • f
n elemen ts from a totally
  • rdered
univ erse sa y in tegers under the
  • p
erations
  • FindMinQ
  • Inser
tQ e
  • DeleteMinQ
  • DeleteQ
e
  • MeldQ
  • Q
  • DecreaseKeyQ
e e
  • Assume
the lo cation
  • f
e is kno wn G S Bro dal W
  • rst
case ecien t data structures
slide-4
SLIDE 4 Priorit y Queues Man y priorit y queues are based
  • n
heap
  • rdered
trees ie eac h no de stores an elemen t and the elemen t stored at a no de is
  • the
elemen t stored at the no des parren t
  • The
priorit y queues heaps
  • f
Willi ams are based
  • n
  • ne
heap
  • rdered
binary tree
  • Inser
t and DeleteMin can b e p er formed in O log n time Willi ams
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-5
SLIDE 5 Linking Heap Ordered T rees More recen t data structures are based
  • n
linking heap
  • rdered
trees
  • f
the same size
  • Ex
Binomial Queues are based
  • n
O log n heap
  • rdered
trees
  • Inser
t Theorem Binomial queues supp
  • rt
Inser t and Meld in amortized constan t time and DeleteMin in amortized O log n time V uillemin
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-6
SLIDE 6 Constan t Time Meldable Priorit y Queues Theorem Inser t and Meld can b e supp
  • rted
in w
  • rst
case constan t time and DeleteMin in w
  • rst
case O log n time
  • One
heap
  • rdered
tree
  • One
linking p er Inser t and Meld
  • r
  • sons
  • f
eac h rank less than the paren ts rank
  • ne
arbitrary rank ed son
  • The
ro
  • t
has rank
  • 1

1 1 1 2 1 1 1 2 3

  • Bro
dal
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-7
SLIDE 7 Constan t Time DecreaseKey Theorem Fib
  • nacci
heaps supp
  • rt
DecreaseKey in amortized constan t time and DeleteMin in amortized O log n time F redman T arjan
  • Theorem
Relaxed heaps supp
  • rt
DecreaseKey in w
  • rst
case constan t time and DeleteMin in w
  • rst
case O log n time Meld requires log n time Driscoll Gab
  • w
Shrairman T arjan
  • Theorem
DecreaseKey and Meld can b e supp
  • rted
in w
  • rst
case constan t time and DeleteMin in w
  • rst
case O log n time Bro dal
  • O
  • heap
  • rdered
trees
  • Relaxed
heaps
  • A
n um b er
  • f
in v arian ts to solv e the tec hnical dep endencies
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-8
SLIDE 8 Comparison Based Priorit y Queues Driscoll Gab
  • w
F redman Shrairman Williams V uillemin Bro dal T arjan T arjan Bro dal
  • Heaps
Binomial Fib
  • nacci
Relaxed Queues Heaps Heaps FindMin O O O O O O Inser t Olog n O O O O O Meld On O O O Olog n O DeleteMin Olog n Olog n Olog n Olog n Olog n Olog n DecreaseKey Olog n Olog n Olog n O O O Amortized b
  • unds
G S Bro dal W
  • rst
case ecien t data structures
slide-9
SLIDE 9 Comparison Based Priorit y Queues Lo w er Bounds Theorem Comparison based sorting requires n log n comparisons
  • Inser
t
  • r
DeleteMin require log n comparisons Theorem If Inser t and Delete mak e O t comparisons then FindMin requires n
  • O
t comparisons
  • a
doubly link ed list is an
  • ptimal
priorit y queue implemen tation Theorem If Meld mak es
  • n
comparisons and FindMin O n
  • comparisons
  • then
Delete and DeleteMin require log n comparisons Bro dal Chaudh uri Radhakrishnan
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-10
SLIDE 10 RAM Priorit y Queues Mo del A unit cost Random Access Mac hine with w
  • rd
size w
  • W
  • rd
  • p
erations
  • shifting
bitwise b
  • lean
  • p
erations Elemen ts In tegers in the range
  • w
  • Op
erations
  • FindMinQ
  • Inser
tQ e
  • DeleteQ
e
  • PredQ
e Pred f
  • g
  • Theorem
The ab
  • v
e
  • p
erations can b e p erformed in O log w
  • time
v an Emde Boas
  • an
O log log n priorit y queue for w
  • log
O
  • n
G S Bro dal W
  • rst
case ecien t data structures
slide-11
SLIDE 11 RAM Priorit y Queues v an Emde Boas Thorup Andersson Bro dal
  • FindMin
O
  • O
  • O
  • O
  • O
  • Inser
t O log w
  • O
log log n O
  • p
log n O f n O log log n Delete O log w
  • O
log log n O
  • p
log n O f n O log log n Pred O log w
  • O
  • p
log n O
  • log
n f n
  • O
  • log
n log log n
  • log
log n
  • f
n
  • p
log n Amortized b
  • unds
G S Bro dal W
  • rst
case ecien t data structures
slide-12
SLIDE 12 Outline
  • f
RAM Priorit y Queue

van Emde Boas

  • f
n elemen ts t in to a w
  • rd
  • log
n f n lev els f n lev els P ac k ed searc h trees
  • f
degree
  • f
n with buers
  • f
dela y ed Inser t and Delete
  • p
erations supp
  • rting
Inser t and Delete in w
  • rst
case O f n time
  • Tw
  • lev
el data structure v an Emde Boas and pac k ed
  • P
ac k ed searc h trees Andersson
  • Buer
trees for external memory
  • Arge
  • List
merging in O
  • w
  • rds
Alb ers Hagerup
  • Standard
deamortization tec hniques Bro dal
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-13
SLIDE 13 Adopting P arallelism to Priorit y Queues Question Is it p
  • ssible
to
  • btain
comparison based priorit y queues supp
  • rting
  • p
erations in
  • log
n time b y using a nonconstan t n um b er
  • f
pro cessors
  • Answ
er Y es O n pro cessors can supp
  • rt
Inser t and DeleteMin in constan t time
  • P
  • P
  • P
  • P
  • P
  • P
  • F
  • lklore
G S Bro dal W
  • rst
case ecien t data structures
slide-14
SLIDE 14 Outline
  • f
P arallel Priorit y Queue
  • P
  • P
  • P
  • P
  • Pro
cessor P i main tains
  • r
  • trees
  • f
size
  • i
  • P
arallel linking and unlinking
  • f
trees Theorem O log n pro cessors can supp
  • rt
Inser t Meld and DeleteMin in constan t time An extension
  • f
the data structure supp
  • rts
Delete and DecreaseKey in constan t time to
  • Bro
dal
  • G
S Bro dal W
  • rst
case ecien t data structures
slide-15
SLIDE 15 P arallel Priorit y Queues Pinotti Pinotti Ranade F
  • lklore
Pucci Das Crupi et al Bro dal
  • FindMin
O
  • O
  • O
log log n O
  • O
  • Inser
t O
  • O
log log n O log log n O
  • O
  • DeleteMin
O
  • O
log log n O log log n O
  • O
  • Meld
O log log n O
  • Delete
O log log n O
  • DecreaseKey
O log log n O
  • pro
cessors n log n log log n log n log log n log n log n Mo del Arra y EREW PRAM CREW PRAM Arra y CREW PRAM
  • r
Arra y G S Bro dal W
  • rst
case ecien t data structures
slide-16
SLIDE 16 P arallel DecreaseKey
  • p
erations Essen tial to algorithms lik e Dijkstras algorithm for the singlesource shortest path problem are the
  • p
erations
  • DeleteMinQ
  • DecreaseKeyQ
e
  • e
  • e
k
  • e
  • k
  • Theorem
There exists an EREW PRAM data structure supp
  • rting
the ab
  • v
e
  • p
erations in constan t time pro vided e
  • e
  • e
  • k
  • Bro
dal T r a Zaroliagis
  • Previous
parallel data structures
  • nly
supp
  • rted
parallel Inser t and DeleteMin
  • p
erations G S Bro dal W
  • rst
case ecien t data structures
slide-17
SLIDE 17 The SingleSource Shortest P ath Problem Theorem The singlesource shortest path problem can b e solv ed b y Dijkstras algorithm in sequen tial O n log n
  • m
time b y using Fib
  • nacci
heaps F redman T arjan
  • Driscoll
Han Gab
  • w
Bro dal P an Shrairman P aige T r a Reif T arjan Krusk al Zaroliagis
  • Time
O log
  • n
O n log n O n log log n O n O n W
  • rk
O n
  • log
n O n log n
  • m
O n
  • O
n
  • O
m log n Mo del EREW EREW CR CW CR CW CREW G S Bro dal W
  • rst
case ecien t data structures
slide-18
SLIDE 18 P artial P ersistence A data structure is said to b e partial p ersisten t if
  • ld
v ersions are remem b ered and can b e accessed
  • nly
the latest v ersion can b e mo died Some naiv e approac hes
  • Store
a cop y
  • f
eac h v ersion
  • f
the data structure
  • space
and time
  • v
erhead p er up date
  • p
eration is O n
  • Only
store the sequence
  • f
c hanges done to the data structure
  • up
date steps in constan t time and space but accesses require O n time G S Bro dal W
  • rst
case ecien t data structures
slide-19
SLIDE 19 P artial P ersitence T ec hniques Driscoll Sarnak Sleator Dietz T arjan Bro dal Raman
  • Dietz
  • Data
structures p
  • in
ter based p
  • in
ter based p
  • in
ter based arra ys Indegree O
  • O
  • log
O
  • n
  • Access
steps O
  • O
  • O
  • O
log log n Up date steps O
  • O
  • O
  • O
log log n amortized
  • tec
hnique requires the RAM
  • exp
ected amortized G S Bro dal W
  • rst
case ecien t data structures
slide-20
SLIDE 20 Summary Comparison based priorit y queues W ADS SOD A NJC
  • Meld
can b e supp
  • rted
in w
  • rst
case constan t time
  • Meld
and DecreaseKey can b e supp
  • rted
in w
  • rst
case constan t time
  • A
lo w er b
  • und
tradeo b et w een up dating a priorit y queue and the query time RAM priorit y queues ST A CS
  • Delete
can b e supp
  • rted
in w
  • rst
case O log log n time
  • Pred
can b e supp
  • rted
in
  • log
n time while ha ving O log log n up date time P arallel priorit y queues SW A T IPPS
  • O
log n pro cessors can supp
  • rt
all
  • p
erations in constan t time
  • P
arallel DecreaseKey in constan t time P artial p ersisten t data structures NJC
  • Bounded
indegree data structures can b e made partially p ersisten t in w
  • rst
case constan t time G S Bro dal W
  • rst
case ecien t data structures
slide-21
SLIDE 21 Appro ximate Dictionary Queries Dist H u v
  • is
the Hamming distance b et w een t w
  • binary
strings u and v
  • f
equal length u
  • v
  • Dist
H u v
  • Dictionary
W
  • fw
  • w
  • w
n g w i
  • f
g m for i
  • n
  • Query
string
  • f
g m
  • Question
Is there an y w i
  • W
suc h that Dist H
  • w
i
  • d
  • d
  • Y
ao Y ao Bro dal G
  • asieniec
  • Query
time O m log log n O m Space O nm log m O nm Prepro cessing time O nm log m O nm G S Bro dal W
  • rst
case ecien t data structures