Time O(log d) Exponential-search(13) Finger Search Searching in a sorted array 1 23578111314151718202425262829313334 time O(log n) Binary-search(13) 23578111314151718202425262829313334.

Slides:



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

List Order Maintenance
Priority Queues  MakeQueuecreate new empty queue  Insert(Q,k,p)insert key k with priority p  Delete(Q,k)delete key k (given a pointer)  DeleteMin(Q)delete.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
Msb(x) in O(1) steps using 5 multiplications Word size n = g∙g, g a power of 2 [M.L. Fredman, D.E. Willard, Surpassing the information-theoretic bound.
Time O(log d) Exponential-search(13) Finger Search Searching in a sorted array time O(log n) Binary-search(13)
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Transform & Conquer Replacing One Problem With Another Saadiq Moolla.
Chapter 6: Transform and Conquer
CS202 - Fundamental Structures of Computer Science II
1 Self-Adjusting Data Structures. 2 Lists [D.D. Sleator, R.E. Tarjan, Amortized Efficiency of List Update Rules, Proc. 16 th Annual ACM Symposium on Theory.
Outline Scapegoat Trees ( O(log n) amortized time)
Unified Access Bound 1 [M. B ă doiu, R. Cole, E.D. Demaine, J. Iacono, A unified access bound on comparison- based dynamic dictionaries, Theoretical Computer.
O(log n) bits or atomic elements
Update 1 Persistent Data Structures (Version Control) v0v0 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 Ephemeral query v0v0 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 Partial persistence.
Purely Functional Worst Case Constant Time Catenable Sorted Lists Gerth Stølting Brodal University of Aarhus Joint work with Christos Makris Kostas Tsichlas.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Convex Hull Algorithms for Dynamic Data Kanat Tangwongsan Joint work with Guy Blelloch and Umut Acar (TTI-C)
Fully Persistent B-Trees 23 rd Annual ACM-SIAM Symposium on Discrete Algorithms, Kyoto, Japan, January 18, 2012 Gerth Stølting Brodal Konstantinos Tsakalidis.
Nick Harvey & Kevin Zatloukal
Red Black Trees Colored Nodes Definition Binary search tree.
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.
The Complexity of Algorithms and the Lower Bounds of Problems
Skip Lists1 Skip Lists William Pugh: ” Skip Lists: A Probabilistic Alternative to Balanced Trees ”, 1990  S0S0 S1S1 S2S2 S3S3 
Binary search trees Definition Binary search trees and dynamic set operations Balanced binary search trees –Tree rotations –Red-black trees Move to front.
Balanced Search Trees CS 3110 Fall Some Search Structures Sorted Arrays –Advantages Search in O(log n) time (binary search) –Disadvantages Need.
1 A Handy Data Structure Space-Efficient Finger Search on Degree-Balanced Search Trees Guy Blelloch, Bruce Maggs, Maverick Woo.
Randomized Algorithms - Treaps
New Balanced Search Trees Siddhartha Sen Princeton University Joint work with Bernhard Haeupler and Robert E. Tarjan.
Data Structure & Algorithm II.  Delete-min  Building a heap in O(n) time  Heap Sort.
CSIT 402 Data Structures II
Sorting. Pseudocode of Insertion Sort Insertion Sort To sort array A[0..n-1], sort A[0..n-2] recursively and then insert A[n-1] in its proper place among.
Advanced Data Structures and Implementation Top-Down Splay Trees Top-Down Splay Trees Red-Black Trees Red-Black Trees Top-Down Red Black Trees Top-Down.
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.
Balanced Search Trees Problem: Efficiency of BST is related to tree’s height.  search, insert and remove follow a path from root to desired location 
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 9.
Λίστα Εργασιών Data Structures for Tree Manipulation D. Harel and R.E. Tarjan. Fast Algorithms for finding nearest common ancestors. SIAM J. Computing,
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.
Implicit Dictionaries with O(1) Modifications per Update and Fast Search Gianni Franceschini and Ian Munro  Elements kept in 1 st n positions of an array.
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.
D. ChristozovCOS 221 Intro to CS II AVL Trees 1 AVL Trees: Balanced BST Binary Search Trees Performance Height Balanced Trees Rotation AVL: insert, delete.
8 January Heap Sort CSE 2011 Winter Heap Sort Consider a priority queue with n items implemented by means of a heap  the space used is.
ADS 1 Algorithms and Data Structures 1 Syllabus Asymptotical notation (Binary trees,) AVL trees, Red-Black trees B-trees Hashing Graph alg: searching,
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
Bottom-Up Red-Black Trees Top-down red-black trees require O(log n) rotations per insert/delete. Color flips cheaper than rotations. Priority search trees.
Exam 3 Review Data structures covered: –Hashing and Extensible hashing –Priority queues and binary heaps –Skip lists –B-Tree –Disjoint sets For each of.
CS6045: Advanced Algorithms Sorting Algorithms. Heap Data Structure A heap (nearly complete binary tree) can be stored as an array A –Root of tree is.
Dynamic Dictionaries Primary Operations:  get(key) => search  put(key, element) => insert  remove(key) => delete Additional operations:  ascend()
CSC 2300 Data Structures & Algorithms March 13, 2007 Chapter 6. Priority Queues.
Self-Adjusting Data Structures
List Order Maintenance
Topics covered (since exam 1):
Persistent Data Structures (Version Control)
Searching in Trees Gerth Stølting Brodal Aarhus University
Treaps.
Dynamic Dictionaries Primary Operations: Additional operations:
Red Black Trees.
CMPS 3130/6130 Computational Geometry Spring 2017
Randomized Algorithms: Data Structures
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
Topics covered (since exam 1):
CS223 Advanced Data Structures and Algorithms
AVL Search Tree put(9)
Dynamic Dictionaries Primary Operations: Additional operations:
8th Workshop on Massive Data Algorithms, August 23, 2016
Priority Queues Supports the following operations. Insert element x.
Topics covered (since exam 1):
Presentation transcript:

time O(log d) Exponential-search(13) Finger Search Searching in a sorted array time O(log n) Binary-search(13) Finger d

O(1) Insertions  Buckets O(log n)  Amortized O(1) insertions (also by 2-4-trees)  2-level buckets O(log 2 n) size  Incremental splitting of buckets  Wost-case O(1) insertions  Split largest bucket 2 n/log 2 n leafs  degree Θ(log n) [C. Levcopoulos, M. Overmars, A balanced search tree with O(1) worst-case update time, Acta Informatica, 1988, 26(3), , 1988]

Zeroing Game  Variables x 1,…,x n  0 (initially x i = 0)  Players Z and A alternate to take turns – Z: Select j where a j = max i x i : x j := 0 – A: Select a 1,…,a n  0 and  i a i = 1 : x i += a i Theorem  i : x i  H n-1 +1  ln n+2 Proof  Consider a vector x (m) after m  n rounds  S k = sum of k largest x i of x (m+1-k)  S n  n (induction)  S i  1+ S i+1  i/(i+1)  S 1  1+S 2 /2  1+1/2+S 2 /3  1+1/2+  +1/(n-1)+S n /n  H n-1 +1 Corollary For the halving game, Z : x i := x i /2 For the splitting game, Z : x i,x i’ := x i /2 3 [P. Dietz, D. Sleator, Two algorithms for maintaining order in a list, Proc. 19th ACM Conf. on Theory of Computing, , 1987] x1x1 x2x2 x 3 ∙ ∙ ∙ ∙ xnxn def  i : x i  2∙(H n-1 +1)

Dynamic Finger Search 4 SearchInsert/Delete Search without fingers Red-black, AVL, 2-4-trees,... Levcopolous, Overmars 1978 O(log n) O(1) O(1) fixed fingers Guibas et al. 1977,....O(log d)O(1) Each node a finger Level-linked (2,4)-treesO(log d) O(log n) O(1) am. Randomized Skip listsO(log d) exp.O(1) exp. TreapsO(log d) exp.O(1) exp. Brodal, Lagogiannis, Makris, Tsakalidis, Tsichlas 2003 Dietz, Raman 1994 (RAM) O(log d)O(1)

Level-Linked (2,4)-trees 5 [S. Huddleston, K. Mehlhorn. A new data structure for representing sorted lists. Acta Informatica, 17:157–184, 1982] Potential Φ = 2 ∙ # degree-4 + # degree-2 UpdatesSplit nodes of degree >4, fusion nodes of degree <2 Search Search up + top-down search finger search(T)

Randomized Skip Lists InsertionIncrease pile to next level with pr. = 1/2 HeightO(log n) expected with high probability PointerHorizontally spans O(1) exp. piles one level below Finger Remember nodes on search path 6 [W. Pugh. Skip lists: A probabilistic alternative to balanced trees. Communications of the ACM, 33(6):668–676, 1990] finger search(D)

Treaps – Randomized Binary Search Trees 7 [R. Seidel and C. R. Aragon. Randomized search trees. Algorithmica, 16(4/5):464–497, 1996]  Each element random priority  Search tree wrt element  Heap order wrt priority  Height O(log n) expected  Insert & deletion rotations O(1) expected time  Search Go up to LCA, and search down – concurrently follow excess path to find next LCA candidate Search path O(log d) expected finger Search(P) excess path

 Merging sorted lists L 1 and L 2 / finger search trees  Merging leaf lists in an arbitrary binary tree O(n∙log n) Proof Induction O(log n!) O(log n 1 ! + log n 2 ! + n 1 ∙log ((n 1 +n 2 )/n 1 )) = O(log n 1 ! + log n 2 ! + log ( )) = O(log (n 1 !  n 2 !  ( ))) = O(log (n 1 +n 2 )!) repeated insertion Application: Binary Merging 8 [S. Huddleston, K. Mehlhorn. A new data structure for representing sorted lists. Acta Informatica, 17:157–184, 1982] L1L1 L2L2 didi n1+n2n1n1+n2n n2n2 n1n n1+n2n1n1+n2n1

Maximal Pairs with Bounded Gap ABCDABDBADAADDABDBACABA 9 [G.S. Brodal, R.B. Lyngsø, C.N.S. Pedersen, J. Stoye. Finding Maximal Pairs with Bounded Gap, Journal of Discrete Algorithms, Special Issue of Matching Patterns, volume 1(1), pages , 2000] P P gap  [low,high] ≠ right maximalleft maximal ≠  Build suffix tree (ST) & make it binary  Create leaf lists at each node  Right-maximal pairs = ST nodes  Find maximal pairs = finger search at ST nodes O(n∙log n+k)