Title: An Optimal Dynamic Interval Stabbing-Max Data Structure?
1An Optimal Dynamic Interval Stabbing-Max Data
Structure?
- Pankaj K. Agarwal, Lars Arge and Ke Yi
- Department of Computer Science
- Duke University
2Problem Definition
- S n intervals in 1D
- w(s) weight of s?S w(s)?R
- Stabbing-max query q?R maxw(s) s?S, q?s
- Three operations
- Query
- Insert an interval
- Delete an interval
3Previous Results
- Trivial if no deletions
- A binary search tree O(n) space, O(log n) query
insert - Interval tree
- Size O(n)
- Query O(log2 n)
- Insert O(log n)
- Delete O(log n)
- Kaplan, Molad and Tarjan STOC03
- The best known result
- Size O(n)
- Query O(log n)
- Insert O(log n)
- Delete O(log n loglog n)
q
4
4
3
2
4
3
1
4Our Results
- Trivial if no deletions
- A binary search tree O(n) space, O(log n) query
insert - Interval tree
- Size O(n)
- Query O(log2 n)
- Insert O(log n)
- Delete O(log n)
- Kaplan, Molad and Tarjan STOC03
- The best known result
- Size O(n)
- Query O(log n)
- Insert O(log n)
- Delete O(log n loglog n)
q
4
4
3
2
4
3
1
5Base Tree T
- Main idea use a base interval tree with fan-out
f - Height of tree O(log n / loglog n)
- Each leaf stores Q(log n) endpoints
- O(n / log3/2 n) internal nodes, O(n / log n)
nodes in total
O( ) slabs
slab
slab
multislab
multislab
multislab
O(log n) multislabs
6Base Tree T
v
S(v) Intervals associated with node v
Each interval is broken into a left, a right and
a middle segment
7Middle Segments Overview
- Answers query within S(v) in O(loglog n) time
- O(log n / loglog n) nodes on the path
- O(log n) time in total
- Insert or delete a segment in O(log n) time
- Only one Mv is affected
- Total time O(log n)
- Size O(S(v) log3/2 n)
- O(n / log3/2 n) internal nodes
- Total size O(n)
- A secondary structure Mv for each internal node v
of the base tree
S(v)
8Secondary Structure Mv
- Build a multislab heap for each multislab
- Stores all segments spanning exactly this
multislab - Build a slab heap for each slab
- Stores the top elements of the relevant multislab
heaps - Query O(loglog n)
- Find the slab heap
- Update O(log n)
- Update the multislab heap O(log n)
- Update the slab heaps
1 2 3 4 5
1
2
3
4
5
Size O(log3/2n)
2-4
3-3
2-5
4-5
1-2
Size O(S(v))
9Left Segments A Static Structure
- L(v) segments in ?iS(ui) with left endpoints in
the slab of v - Basic idea answer query inL(v) - L(w4) when
visiting v - f(wj) maximum interval inL(v) with left
endpoint in the slab of wj - Organize in a tournament tree
- Can find the maximumof the red segmentsin time
O(loglog n) - Total O(log n)
q
f(w2)
u2
u1
v
w1 w2 w3 w4 w5
f(w1)
f(w2)
f(w3)
f(w4)
10Updating f
- Each segment at u2 affects the f values at O(log
n / loglog n) descendents - Each f can be updatedin O(loglog n) time (using
additional structures) - Total update time O(log n)
- Other issues (omitted)
- Rebalancing of the base tree
u2
u1
v
w1 w2 w3 w4 w5
11Is It Really Optimal?
- Is the O(log n) deletion bound really optimal?
- The O(log n) query bound is optimal in comparison
model - Can show O(log n) query ? W(log n) insert
- O(log n) query insert ? W(log n) delete ?
- Probably yes
- Errata (Theorem 4.2 4.3)
- Query update time
- O(logd-1n) ? O(logdn)
12Thank you!
13Putting Everything Together
y(u, v) maxy(u, w), for all of vs children
w f(w) maxy(u, w), for all vs ancestors u
execpt p(w)
Ta
Base tree
y(a,b)
a
y(a,c)
y(a,d)
y(a,e)
b
Tb
c
d
y(b,c)
y(b,d)
Consider f(e)
y(b,e)
y(b,f)
y(b,g)
g
f
e
h
i
j
Td
Tc
y(d,e)
y(c,e)
y(c,f)
y(c,g)
y(d,f)
y(d,g)
14Putting Everything Together
Update O(log n / loglog n loglog n) O(log n)
Only one Tv is affected
Ta
Base tree
y(a,b)
a
y(a,c)
y(a,d)
y(a,e)
b
Tb
c
d
Total size is still linear
y(b,c)
y(b,d)
y(b,e)
g
f
e
h
i
j
Td
Tc
y(d,e)
y(c,e)