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

CS 225 Lab #11 – Skip Lists.
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.
Transform & Conquer Replacing One Problem With Another Saadiq Moolla.
Chapter 6: Transform and Conquer
More on Randomized Data Structures. Motivation for Randomized Data Structures We’ve seen many data structures with good average case performance on random.
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.
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.
Dynamic Dictionaries Primary Operations:  Get(key) => search  Insert(key, element) => insert  Delete(key) => delete Additional operations:  Ascend()
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.
Red Black Trees Colored Nodes Definition Binary search tree.
Skip Lists1 Skip Lists William Pugh: ” Skip Lists: A Probabilistic Alternative to Balanced Trees ”, 1990  S0S0 S1S1 S2S2 S3S3 
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.
Balanced Binary Search Trees height is O(log n), where n is the number of elements in the tree AVL (Adelson-Velsky and Landis) trees red-black trees get,
Randomized Algorithms - Treaps
Different Tree Data Structures for Different Problems
Time O(log d) Exponential-search(13) Finger Search Searching in a sorted array time O(log n) Binary-search(13)
The Binary Heap. Binary Heap Looks similar to a binary search tree BUT all the values stored in the subtree rooted at a node are greater than or equal.
Data Structure & Algorithm II.  Delete-min  Building a heap in O(n) time  Heap Sort.
CS Winter 2010 Tree Sort. Useful Properties of Sorted Data Structures Skip Lists (as well as AVL Trees, and various other data structures we will.
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 
AVL Trees. AVL Node Structure The AVL node structure follows the same structure as the binary search tree, with the addition of a term to store the.
Λίστα Εργασιών 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.
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.
Queues, Stacks and Heaps. Queue List structure using the FIFO process Nodes are removed form the front and added to the back ABDC FrontBack.
CSS446 Spring 2014 Nan Wang.  to study trees and binary trees  to understand how binary search trees can implement sets  to learn how red-black trees.
CIS 068 Welcome to CIS 068 ! Lesson 12: Data Structures 3 Trees.
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.
1Computer Sciences. 2 HEAP SORT TUTORIAL 4 Objective O(n lg n) worst case like merge sort. Sorts in place like insertion sort. A heap can be stored as.
AVL TREES By Asami Enomoto CS 146 AVL Tree is… named after Adelson-Velskii and Landis the first dynamically balanced trees to be propose Binary search.
Dynamic Dictionaries Primary Operations:  get(key) => search  put(key, element) => insert  remove(key) => delete Additional operations:  ascend()
B-Trees Katherine Gurdziel 252a-ba. Outline What are b-trees? How does the algorithm work? –Insertion –Deletion Complexity What are b-trees used for?
Self-Adjusting Data Structures
School of Computing Clemson University Fall, 2012
Lec 13 Oct 17, 2011 AVL tree – height-balanced tree Other options:
Red-Black Tree Neil Tang 02/07/2008
Red-Black Tree Neil Tang 02/04/2010
List Order Maintenance
AVL Trees 6/25/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M.
Persistent Data Structures (Version Control)
Red-Black Trees 9/12/ :44 AM AVL Trees v z AVL Trees.
Searching in Trees Gerth Stølting Brodal Aarhus University
Treaps.
Dynamic Dictionaries Primary Operations: Additional operations:
AVL Trees 4/29/15 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H.
Red-Black Trees 11/13/2018 2:07 AM AVL Trees v z AVL Trees.
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
CS223 Advanced Data Structures and Algorithms
AVL Search Tree put(9)
Dynamic Dictionaries Primary Operations: Additional operations:
(2,4) Trees 2/15/2019 (2,4) Trees (2,4) Trees.
CS223 Advanced Data Structures and Algorithms
Red-Black Trees 2/24/ :17 AM AVL Trees v z AVL Trees.
(2,4) Trees 2/28/2019 3:21 AM Sorting Lower Bound Sorting Lower Bound.
Binary and Binomial Heaps
Priority Queues Supports the following operations. Insert element x.
Red-Black Trees 5/19/2019 6:39 AM AVL Trees v z AVL Trees.
Red Black Trees Colored Nodes Definition Binary search tree.
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

Dynamic Finger Search 2 SearchInsert/Delete No fingers Red-black, AVL, 2-4-trees,...O(log n) 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 O(log d)O(1)

Level-Linked (2,4)-trees 3 [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 4 [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 5 [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 ! + n 1 ∙log ( ) = O(log n 1 ! + log n 2 ! + (n 1 +n 2 )∙log (n 1 +n 2 ) - log n 1 ! - log n 2 !) = O(log (n 1 +n 2 )!) repeated insertion Application: Binary Merging 6 [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

Maximal Pairs with Bounded Gap ABCDABDBADAADDABDBACABA 7 [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)