# An Optimal Dynamic Interval Stabbing-Max Data Structure? Pankaj K. Agarwal, Lars Arge and Ke Yi Department of Computer Science Duke University.

## Presentation on theme: "An Optimal Dynamic Interval Stabbing-Max Data Structure? Pankaj K. Agarwal, Lars Arge and Ke Yi Department of Computer Science Duke University."— Presentation transcript:

An Optimal Dynamic Interval Stabbing-Max Data Structure? Pankaj K. Agarwal, Lars Arge and Ke Yi Department of Computer Science Duke University

2 Problem Definition S : n intervals in 1D w(s) : weight of s  S; w(s)  R Stabbing-max query q  R : max{w(s) | s  S, q  s} q 2 3 4 5 1 Three operations: Query Insert an interval Delete an interval

3 Trivial if no deletions A binary search tree: O(n) space, O(log n) query & insert Interval tree Size: O(n) Query: O(log 2 n) Insert: O(log n) Delete: O(log n) Kaplan, Molad and Tarjan [STOC ’ 03] The best known result Size: O(n) Query: O(log n) Insert: O(log n) Delete: O(log n loglog n) Previous Results 1 3 4 2 3 4 4 q

4 Trivial if no deletions A binary search tree: O(n) space, O(log n) query & insert Interval tree Size: O(n) Query: O(log 2 n) Insert: O(log n) Delete: O(log n) Kaplan, Molad and Tarjan [STOC ’ 03] The best known result Size: O(n) Query: O(log n) Insert: O(log n) Delete: O(log n loglog n) Our Results 1 3 4 2 3 4 4 q

5 Base 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 / log 3/2 n) internal nodes, O(n / log n) nodes in total slab multislab slab multislab O( ) slabs O(log n) multislabs

6 Base Tree T v S(v): Intervals associated with node v Each interval is broken into a left, a right and a middle segment

7 Middle 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 M v is affected Total time: O(log n) Size: O(|S(v)| + log 3/2 n) O(n / log 3/2 n) internal nodes Total size: O(n) S(v)S(v) A secondary structure M v for each internal node v of the base tree

8 Secondary Structure M v 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 2-43-3 2-5 123 1 2 3 4 5 Size: O(|S(v)|) Size: O(log 3/2 n) 45 4-5

9 Left Segments: A Static Structure L(v) : segments in  i S(u i ) with left endpoints in the slab of v Basic idea: answer query in L(v) − L( w 4 ) when visiting v f (w j ) : maximum interval in L(v) with left endpoint in the slab of w j Organize in a tournament tree Can find the maximum of the red segments in time O(loglog n) Total: O(log n) w 1 w 2 w 3 w 4 w 5 v u1u1 f(w2)f(w2) u2u2 f(w1)f(w1) f(w2)f(w2) f(w3)f(w3) f(w4)f(w4) q

10 Updating f Each segment at u 2 affects the f values at O(log n / loglog n) descendents Each f can be updated in O(loglog n) time (using additional structures) Total update time: O(log n) Other issues (omitted) Rebalancing of the base tree w 1 w 2 w 3 w 4 w 5 v u1u1 u2u2

11 Is 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(log d-1 n) → O(log d n)

Thank you!

13 Putting Everything Together y (u, v) = max{ y (u, w), for all of v ’s children w} f (w) = max{ y (u, w), for all v ’s ancestors u execpt p(w)} a b cd e gf hij Base tree y (a,b) y (a,c) y (a,d) y (a,e) TaTa y (b,c) y (b,d) y (b,e) TbTb y (c,e) TcTc y (d,e) TdTd Consider f (e) y (b,f) y (b,g) y (c,f) y (c,g) y (d,f) y (d,g)

14 Putting Everything Together Update: O(log n / loglog n · loglog n) = O(log n) a b cd e gf hij Base tree y (a,b) y (a,c) y (a,d) y (a,e) TaTa y (b,c) y (b,d) y (b,e) TbTb y (c,e) TcTc y (d,e) TdTd Only one T v is affected Total size is still linear

Download ppt "An Optimal Dynamic Interval Stabbing-Max Data Structure? Pankaj K. Agarwal, Lars Arge and Ke Yi Department of Computer Science Duke University."

Similar presentations