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

Slides:



Advertisements
Similar presentations
Mathematical Preliminaries
Advertisements

Chapter 13. Red-Black Trees
COSC 2007 Data Structures II Chapter 12 Advanced Implementation of Tables II.
David Luebke 1 6/1/2014 CS 332: Algorithms Medians and Order Statistics Structures for Dynamic Sets.
CS16: Introduction to Data Structures & Algorithms
Binary Tree Structure a b fe c a rightleft g g NIL c ef b left right pp p pp left key.
David Luebke 1 8/25/2014 CS 332: Algorithms Red-Black Trees.
10 -1 Chapter 10 Amortized Analysis A sequence of operations: OP 1, OP 2, … OP m OP i : several pops (from the stack) and one push (into the stack)
Binary Search Trees Ravi Chugh March 28, Review: Linked Lists Goal: Program that keeps track of friends Problem: Arrays have fixed length Solution:
Splay Trees Binary search trees.
AVL Trees CSE 373 Data Structures Lecture 8. 12/26/03AVL Trees - Lecture 82 Readings Reading ›Section 4.4,
CSE Lecture 17 – Balanced trees
Rizwan Rehman Centre for Computer Studies Dibrugarh University
Foundations of Data Structures Practical Session #7 AVL Trees 2.
Succinct Representations of Dynamic Strings Meng He and J. Ian Munro University of Waterloo.
Planar point location -- example
Orthogonal range searching. The problem (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of.
Chapter 4: Trees Part II - AVL Tree
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
1 Finger search trees. 2 Goal Keep sorted lists subject to the following operations: find(x,L) insert(x,L) delete(x,L) catenate(L1,L2) : Assumes that.
Time O(log d) Exponential-search(13) Finger Search Searching in a sorted array time O(log n) Binary-search(13)
Data Structures Haim Kaplan and Uri Zwick November 2012 Lecture 5 B-Trees.
EECS 311: Chapter 4 Notes Chris Riesbeck EECS Northwestern.
Purely Functional Worst Case Constant Time Catenable Sorted Lists Gerth Stølting Brodal University of Aarhus Joint work with Christos Makris Kostas Tsichlas.
Advanced Tree Data Structures Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Binary Search Trees Implementing Balancing Operations –AVL Trees –Red/Black Trees Reading:
Fully Persistent B-Trees 23 rd Annual ACM-SIAM Symposium on Discrete Algorithms, Kyoto, Japan, January 18, 2012 Gerth Stølting Brodal Konstantinos Tsakalidis.
B + -Trees (Part 1) COMP171. Slide 2 Main and secondary memories  Secondary storage device is much, much slower than the main RAM  Pages and blocks.
1 Red Black Trees (Guibas Sedgewick 78). 2 Goal Keep sorted lists subject to the following operations: find(x,L) insert(x,L) delete(x,L) catenate(L1,L2)
Balanced Trees. Binary Search tree with a balance condition Why? For every node in the tree, the height of its left and right subtrees must differ by.
1 Binomial heaps, Fibonacci heaps, and applications.
Strict Fibonacci Heaps Gerth Stølting Brodal Aarhus University George Lagogiannis Robert Endre Tarjan Agricultural University of Athens Princeton University.
Time O(log d) Exponential-search(13) Finger Search Searching in a sorted array time O(log n) Binary-search(13)
Trevor Brown – University of Toronto B-slack trees: Space efficient B-trees.
Balanced Trees (AVL and RedBlack). Binary Search Trees Optimal Behavior ▫ O(log 2 N) – perfectly balanced tree (e.g. complete tree with all levels filled)
Balanced Search Trees Fundamental Data Structures and Algorithms Margaret Reid-Miller 3 February 2005.
B-Trees and Red Black Trees. Binary Trees B Trees spread data all over – Fine for memory – Bad on disks.
AVL Tree Definition: Theorem (Adel'son-Vel'skii and Landis 1962):
1 Trees 4: AVL Trees Section 4.4. Motivation When building a binary search tree, what type of trees would we like? Example: 3, 5, 8, 20, 18, 13, 22 2.
Lecture 11COMPSCI.220.FS.T Balancing an AVLTree Two mirror-symmetric pairs of cases to rebalance the tree if after the insertion of a new key to.
Oct 26, 2001CSE 373, Autumn A Forest of Trees Binary search trees: simple. –good on average: O(log n) –bad in the worst case: O(n) AVL trees: more.
Four different data structures, each one best in a different setting. Simple Heap Balanced Heap Fibonacci Heap Incremental Heap Our results.
Review for Exam 2 Topics covered (since exam 1): –Splay Tree –K-D Trees –RB Tree –Priority Queue and Binary Heap –B-Tree For each of these data structures.
1 Fat heaps (K & Tarjan 96). 2 Goal Want to achieve the performance of Fibonnaci heaps but on the worst case. Why ? Theoretical curiosity and some applications.
Two-tier relaxed heaps Presented by Claus Jensen Joint work with Amr Elmasry and Jyrki Katajainen Slides available at
CMSC 341 Binomial Queues and Fibonacci Heaps. Basic Heap Operations OpBinary Heap Leftist Heap Binomial Queue Fibonacci Heap insertO(lgN) deleteMinO(lgN)
Kinetic Heaps K, Tarjan, and Tsioutsiouliklis. Broadcast Scheduling Parametric and Kinetic Heaps Broadcast Scheduling Using a Kinetic Heap The Computational.
Foundation of Computing Systems Lecture 4 Trees: Part I.
More Trees. Outline Tree B-Tree 2-3 Tree Tree Red-Black Tree.
Lecture 15 Nov 3, 2013 Height-balanced BST Recall:
Multiway Search Trees Data may not fit into main memory
Topics covered (since exam 1):
Balancing Binary Search Trees
Persistent Data Structures (Version Control)
Chapter 6 Transform-and-Conquer
Finger search trees.
Lecture 16 Multiway Search Trees
Balanced Trees (AVL and RedBlack)
Searching in Trees Gerth Stølting Brodal Aarhus University
Dynamic Dictionaries Primary Operations: Additional operations:
Red Black Trees.
Haim Kaplan and Uri Zwick November 2014
Chapter 6 Transform and Conquer.
Wednesday, April 18, 2018 Announcements… For Today…
Topics covered (since exam 1):
Topics covered (since exam 1):
B-Tree Insertions, Intro to Heaps
Strict Fibonacci Heaps
Topics covered (since exam 1, excluding PQ):
Red Black Trees Colored Nodes Definition Binary search tree.
Presentation transcript:

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 [ESA 06, Brodal, Makris, Tsichlas] Open Problems

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

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

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

How do we Count? MSB LSB Ops Ops Op Op

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

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

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

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

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

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

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)

Catenable Sorted Lists in Worst-Case Constant Time

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

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

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)

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

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

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

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

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

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

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

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 …

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