1 / 26

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

Turning Amortized to Worst-Case Data Structures: Techniques and Results. Tsichlas Kostas. 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

galia
Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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-CaseComplexities • Amortized: N operations on a set of n elements costO(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 worst-case amortized Question:g(N)=O(f(N,n)/N) (????)

  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. 1 Op 6 Ops 6 Ops 1 Op 0 1 0 0 1 0 1 1 1 0 1 1 +1 +1 -1 -1 1 0 1 1 1 0 1 1 1 0 1 0 31 32 31 30 How do we Count? MSB 0 1 1 1 1 LSB 0 30

  7. A New Way to Count MSB 1 1 1 • 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(dj) Ifdj=2 thendj=0 καιdj+1=dj+1+1 2 2 2 0 0 0 0 0 0 +1 Fix 1 1 1 1 2 1 • Increase(x) • x=x+1 • i = min{j:dj1} • Fix(dj) 2 0 2 1 1 1 LSB 0 1 1 546 547 547*

  8. 2 Ops 2 Ops 2 Ops 2 Ops 2 Ops 0 0 0 0 0 0 2 2 2 1 2 2 0 0 -1 1 0 -1 -1 +1 +1 -1 -1 -1 -1 1 1 0 1 2 1 1 0 0 0 0 1 0 0 1 1 32 31 30 28 33 29 + and - Use 4 digits {-1,0,1,2}, where 2 represents the carry and -1 the residue. 0 2 0 -1 1 1 31

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

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

  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 DeletionSearch 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. Component records with root pointers (valid or invalid) r Link(v) Break(r) Link(v) v Components 4 5 6 8 9 11 13 15 17 19 21 23 24 27 31 33 34 35 37 41 42 51 53 • Mechanism to identify where to rebalance • Components =partition of internal nodes into subtrees

  14. Catenable Sorted Lists in Worst-Case Constant Time

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

  16. Catenable Sorted Lists: Search Trees (2,3-trees) • Search for appropriate position • Link T1 • Rebalance root T2 31 33 34 35 37 41 42 51 53 58 60 61 64 67 71 72 74 75

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

  18. Catenable Sorted Lists n = |T| ns = min(|T1|,|T2|) * amortized

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

  20. height O(log n) Problem: Nodes of arbitrary degree Idea 1: Linking By Size T1 T2

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

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

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

  24. Conclusion * 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 root 4 5 6 8 9 11 13 15 17 19 21 23 24 27 31 33 34 35 37 41 42 51 53 10 d=7 f’ x f Insertion: O(logn)w.c.t. Deletion: O(logn) w.c.t. Search: O(logd) w.c.t. Update Operations: • Search • Update • Rebalance

More Related