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.

Slides:



Advertisements
Similar presentations
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.
Advertisements

D. D. Sleator and R. E. Tarjan | AT&T Bell Laboratories Journal of the ACM | Volume 32 | Issue 3 | Pages | 1985 Presented By: James A. Fowler,
Advanced Data structure
EECS 4101/5101 Prof. Andy Mirzaian. Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees Trees Red-Black.
A Self-adjusting Data Structure for Multi-dimensional Point Sets Eunhui Park & David M. Mount University of Maryland Sep
Priority Queues And the amazing binary heap Chapter 20 in DS&PS Chapter 6 in DS&AA.
AA Trees another alternative to AVL trees. Balanced Binary Search Trees A Binary Search Tree (BST) of N nodes is balanced if height is in O(log N) A balanced.
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.
Computer Science CS 330: Algorithms Priority Queues Gene Itkis.
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.
Heaps and heapsort COMP171 Fall Sorting III / Slide 2 Motivating Example 3 jobs have been submitted to a printer in the order A, B, C. Sizes: Job.
1 Minimize average access time Items have weights: Item i has weight w i Let W =  w i be the total weight of the items Want the search to heavy items.
1 COSC 2P03 Lecture #5 – Trees Part III, Heaps. 2 Today Take up the quiz Assignment Questions Red-Black Trees Binary Heaps Heap sort D-Heaps, Leftist.
CSE 373 Data Structures Lecture 12
Dijkstra/Prim 1 make-heap |V| insert |V| delete-min |E| decrease-key Priority Queues make-heap Operation insert find-min delete-min union decrease-key.
Initializing A Max Heap input array = [-, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
CSE 326: Data Structures Lecture #13 Extendible Hashing and Splay Trees Alon Halevy Spring Quarter 2001.
DART! Time Assigner By: Matt Ivers and Ray Kilway.
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.
Binary search trees Definition Binary search trees and dynamic set operations Balanced binary search trees –Tree rotations –Red-black trees Move to front.
Princeton University COS 423 Theory of Algorithms Spring 2002 Kevin Wayne Fibonacci Heaps These lecture slides are adapted from CLRS, Chapter 20.
Splay Trees Splay trees are binary search trees (BSTs) that:
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
Splay Trees and B-Trees
Advanced Data Structures and Algorithms COSC-600 Lecture presentation-6.
Heapsort Based off slides by: David Matuszek
Leftist Trees Linked binary tree. Can do everything a heap can do and in the same asymptotic complexity.  insert  remove min (or max)  initialize Can.
PRIORITY QUEUES (HEAPS). Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important.
ADT Table and Heap Ellen Walker CPSC 201 Data Structures Hiram College.
§8 Binomial Queues Haven’t we had enough about queues? What is a binomial queue for? Well, what is the average time for insertions with leftist or skew.
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.
B + -Trees Same structure as B-trees. Dictionary pairs are in leaves only. Leaves form a doubly-linked list. Remaining nodes have following structure:
1 Splay trees (Sleator, Tarjan 1983). 2 Goal Support the same operations as previous search trees.
Search Trees Chapter   . Outline  Binary Search Trees  AVL Trees  Splay Trees.
WEEK 3 Leftist Heaps CE222 Dr. Senem Kumova Metin CE222_Dr. Senem Kumova Metin.
Λίστα Εργασιών Data Structures for Tree Manipulation D. Harel and R.E. Tarjan. Fast Algorithms for finding nearest common ancestors. SIAM J. Computing,
Chapter 2: Basic Data Structures. Spring 2003CS 3152 Basic Data Structures Stacks Queues Vectors, Linked Lists Trees (Including Balanced Trees) Priority.
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.
1 Biased 2-b trees (Bent, Sleator, Tarjan 1980). 2 Goal Keep sorted lists subject to the following operations: find(x,L) insert(x,L) delete(x,L) catenate(L1,L2)
Change Keys in heaps Fibonacci heap Zhao Xiaobin.
1 Binomial Tree Binomial tree. n Recursive definition: B k-1 B0B0 BkBk B0B0 B1B1 B2B2 B3B3 B4B4.
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.
IT 60101: Lecture #121 Foundation of Computing Systems Lecture 12 Trees: Part VII.
Initializing A Max Heap input array = [-, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
CS 5243: Algorithms Balanced Trees AVL : Adelson-Velskii and Landis(1962)
Dynamic Dictionaries Primary Operations:  get(key) => search  put(key, element) => insert  remove(key) => delete Additional operations:  ascend()
1 Fibonacci heaps: idea List of multiway trees which are all heap-ordered. Definition: A tree is called heap-ordered if the key of each node is greater.
CSC 2300 Data Structures & Algorithms March 13, 2007 Chapter 6. Priority Queues.
SPLAY TREE The basic idea of the splay tree is that every time a node is accessed, it is pushed to the root by a series of tree rotations. This series.
Leftist Trees Linked binary tree.
Self-Adjusting Data Structures
AA Trees.
Heaps (8.3) CSE 2011 Winter May 2018.
Self-Adjusting Search trees
List Order Maintenance
Topics covered (since exam 1):
Persistent Data Structures (Version Control)
Hashing Exercises.
Source: Muangsin / Weiss
Dynamic Dictionaries Primary Operations: Additional operations:
Topics covered (since exam 1):
Strict Fibonacci Heaps
Heaps By JJ Shepherd.
Topics covered (since exam 1):
CS 6310 Advanced Data Structure Wei-Shian Wang
A Heap Is Efficiently Represented As An Array
Splay Trees Binary search trees.
Presentation transcript:

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 of Computing, , 1984] Dictionaries [D.D. Sleator, R.E. Tarjan, Self-Adjusting Binary Search Trees, Journal of the ACM, 32(3): , 1985]  splay trees Priority Queues [C.A. Crane, Linear lists and priority queues as balanced binary trees, PhD thesis, Stanford University, 1972] [D.E. Knuth. Searching and Sorting, volume 3 of The Art of Computer Programming, Addison-Wesley, 1973]  leftist heaps [D.D. Sleator, R.E. Tarjan, Self-Adjusting Heaps, SIAM Journal of Computing, 15(1): 52-69, 1986]  skew heaps [C. Okasaki, Alternatives to Two Classic Data Structures, Symposium on Computer Science Education, , 2005]  maxiphobix heaps Okasaki: maxiphobix heaps are an alternative to leftist heaps... but without the “magic” Search(2), Search(2), Search(2), Search(5), Search(5), Search(5) move-to-front

= Meld (, ) Meld (, ) Meld (, ) = [C.A. Crane, Linear lists and priority queues as balanced binary trees, PhD thesis, Stanford University, 1972] [D.E. Knuth. Searching and Sorting, volume 3 of The Art of Computer Programming, Addison-Wesley, 1973] MakeHeap, FindMin, Insert, Meld, DeleteMin 3 Heaps Meld Cut root + Meld == (via Binary Heap-Ordered Trees) Maxiphobic Heaps T3T3 y T1T1 T2T2 x TiTi TjTj TkTk x largest sizetwo smallest Max size n  ⅔n Time O(log 3/2 n) Each node distance to empty leaf Inv. Distance right child  left child  rightmost path   log n+1  nodes x < y [C. Okasaki, Alternatives to Two Classic Data Structures, Symposium on Computer Science Education, , 2005] Leftist Heaps merge rightmost paths Time O(log n)

Meld (, ) = [D.D. Sleator, R.E. Tarjan, Self-Adjusting Heaps, SIAM Journal of Computing, 15(1): 52-69, 1986] 4 Skew Heaps Meld Cut root + Meld == O(log n) amortized Meld Heavy right child on merge path before meld  replaced by light child  1 potential released for heavy node  amortized cost 2∙ # light children on rightmost paths before meld merge rightmost paths  Heap ordered binary tree with no balance information  MakeHeap, FindMin, Insert, Meld, DeleteMin  Meld = merge rightmost paths + swap all siblings on merge path v heavy if |T v | > |T p(v) |/2, otherwise light  any path  log n light nodes Potential  = # heavy right children in tree

Meld (, ) = [D.D. Sleator, R.E. Tarjan, Self-Adjusting Heaps, SIAM Journal of Computing, 15(1): 52-69, 1986] 5 Skew Heaps – O(1) time Meld O(1) amortized Meld Heavy right child on merge path before meld  replaced by light child  1 potential released Light nodes disappear from major paths (but might  heavy)   1 potential released and become a heavy or light right children on major path  potential increase by  4 O(log n) amortized DeleteMin Cutting root  2 new minor paths, i.e.  2∙log n new light children on minor & major paths merge rightmost paths  Meld = Bottom-up merg of rightmost paths + swap all siblings on merge path not touched previously minor minor major  = # heavy right children in tree + 2 ∙ # light children on minor & major path = 4 5

6 [D.D. Sleator, R.E. Tarjan, Self-Adjusting Binary Search Trees, Journal of the ACM, 32(3): , 1985] Splay Trees  Binary search tree with no balance information  splay(x) = rotate x to root (zig/zag, zig-zig/zag-zag, zig-zag/zag-zig)  Search (splay), Insert (splay predecessor+new root), Delete (splay+cut root+join), Join (splay max, link), Split (splay+unlink) B y A x C C x B y A zig B y A x C D y C z B zig-zig z D x A C y B x A D x C z B zig-zag z D y A root D y C x B v F z A u E B x A z C zag-zag zig-zig F u E v D y B x A z C F u E v D y insert

7 [D.D. Sleator, R.E. Tarjan, Self-Adjusting Binary Search Trees, Journal of the ACM, 32(3): , 1985] Splay Trees  The access bounds of splay trees are amortized (1) O(log n) (2) Static optimal (3) Static finger optimal (4) Working set optimal (proof requires dynamic change of weight)  Static optimality:  = v log |T v | 