Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turning Amortized to Worst-Case Data Structures: Techniques and Results Tsichlas Kostas.

Similar presentations


Presentation on theme: "Turning Amortized to Worst-Case Data Structures: Techniques and Results Tsichlas Kostas."— Presentation transcript:

1 Turning Amortized to Worst-Case Data Structures: Techniques and Results Tsichlas Kostas

2 Talk Structure Techniques Guaranteed Complexities of Data Structures: –The finger search tree problem [STOC 02, Brodal, Lagogiannis, Makris, Tsakalidis, Tsichlas] –The merge of search trees problem [ESA 06, Brodal, Makris, Tsichlas] Open Problems

3 Amortized vs Worst-Case Complexities Amortized: N operations on a set of n elements cost O(f(N,n)) time, –The mean cost of each operation is O(f(N,n)/N) –There may be operations which are expensive Worst-Case: Each operation costs O(g(n)). –Usually more complicated design that amortized structures Question: g(N)=O(f(N,n)/N) (????) amortized worst-case

4 Conversion Techniques to Worst-Case Complexities Incremental Scheduling of Operations: –Redundant Number Systems –Stricter Invariants on the structure –Local or Global Rebuilding

5 Redundant Number Systems For each number there is only one representation (usual number systems) For each number there are multiple representations (redundant number systems)

6 How do we Count? MSB LSB Ops Ops Op Op

7 A New Way to Count Use 3 digits {0,1,2}, where 2 represents the carry. Between two 2s there is always a zero The first digit from the LSB different to 1 is always a 0 Fix(d j ) If d j = 2 then d j = 0 και d j+1 = d j+1 +1 Increase(x) 1.x = x+1 2.i = min{j:d j 1} 3.Fix(d j ) MSB LSB * Fix

8 + and - Use 4 digits {-1,0,1,2}, where 2 represents the carry and -1 the residue Ops Ops Ops Ops Ops

9 MSB LSB Simple Counters on (2,3)-trees --A node has 3 children 1 --A node has 2 children

10 MSB LSB Redundant Counters on (2,3)-trees --A node has 3 children 1 --A node has 4 children 2 --A node has 2 children 0 --A node has 1 child

11 What about Arbitrary Updates? Redundant number representation cannot be used in this case because of the tree structure. Somehow we must come up with a tree counter

12 Known Results Insertion Deletion Search AVL-trees, (2,3)-trees (a) Red-Black trees, (2,4)-trees (a,b) Levcopoulos, Overmars 88 (a) Guibas et al. 77, Tsakalidis 85 (a,c) Harel, Lucker 79 (a) Huddleston, Mehlhorn 82 (a,b) Brodal 98 (a) Brodal et al. 02 (a) Dietz, Raman 94 (d) Andersson, Thorup 00 (e) (a) Pointer Machine (b) Amortized Complexity (c) O(1) Movable Fingers (d) Comparison RAM (e) Word RAM

13 Components Mechanism to identify where to rebalance Components = partition of internal nodes into subtrees Link(v) v Break(r) r Link(v) Component records with root pointers (valid or invalid)

14 Catenable Sorted Lists in Worst-Case Constant Time

15 Catenable Sorted Lists Insert(T,x) Delete(T,x) Search(T,x) Join(T 1,T 2 ) Split(T,x) T 1 = 2,5,7,8,10,11 T 2 = 13,17,19,34,58,79 Join(T 1,T 2 ) = 2,5,7,8,10,11,13,17,19,34,58,79 This talk

16 root Catenable Sorted Lists: Search Trees (2,3-trees) Search for appropriate position 2.Link 3.Rebalance T1T1 T2T2

17 Catenable Sorted Lists: Search Trees (2,4-trees, red-black trees…) T1T1 T2T Search Link Rebalance Worst-case O(1) Worst-case O(log |T 1 |) Worst-case O(log |T 2 |) or amortized O(1) or O(loglog |T 2 |) or worst-case O(1) or amortized O(1)

18 Catenable Sorted Lists Search trees Kaplan Tarjan96 This talk Searchlog n Insert/Deletelog n Joinlog n 1*loglog n s 1 Splitlog nlog n s - n = |T| n s = min(|T 1 |,|T 2 |) * amortized

19 O(1) Join and O(log n) Search The ideas….

20 Problem: Nodes of arbitrary degree Idea 1: Linking By Size T1T1 T2T2 height O(log n)

21 Idea 2: Represent Nodes by Weight-Balanced Trees Problem: Does not support linking by size in O(1) time O(log n)

22 Idea 3: Tree-Collections and Lazy Join Tree collection k trees k levels Weight- balanced tree

23 Idea 3 (cont.): Lazy Join Old tree collection New tree collection k trees k levels

24 Conclusion Search treesThis talk Searchlog n Insert/Deletelog n Joinlog n 1*1 Splitlog n- * amortized purely functional

25 Open Problems Very Hard… Dynamic Fractional Cascading (O(loglogn) worst-case) Full Persistence (O(1) worst-case) … Hard… Simple Constant Update Finger Trees Support the split operation in the constant catenable sorted list …

26 Finger Searching in (2,4)-trees Insertion: O(logn) w.c.t. Deletion: O(logn) w.c.t. Search: O(logd) w.c.t. 1.Search 2.Update 3.Rebalance Update Operations: fx d=7 f root


Download ppt "Turning Amortized to Worst-Case Data Structures: Techniques and Results Tsichlas Kostas."

Similar presentations


Ads by Google