ECE750-TXB Lecture 8: Treaps, Tries, and Hash Tables

Total Page:16

File Type:pdf, Size:1020Kb

ECE750-TXB Lecture 8: Treaps, Tries, and Hash Tables ECE750-TXB Lecture 8: Treaps, Tries, and Hash Tables Todd L. ECE750-TXB Lecture 8: Treaps, Tries, and Veldhuizen Hash Tables [email protected] Review: Treaps Tries Todd L. Veldhuizen Hash Tables [email protected] Bibliography Electrical & Computer Engineering University of Waterloo Canada February 1, 2007 ECE750-TXB Review: Treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen I Recall that a binary search tree has keys drawn from a [email protected] totally ordered structure hK, ≤i Review: Treaps I An inorder traversal of the tree recovers the keys in Tries ascending order. Hash Tables Bibliography d b h a c f i ECE750-TXB Review: Treaps Lecture 8: Treaps, Tries, and Hash Tables Recall that a heap has priorities drawn from a totally Todd L. I Veldhuizen ordered structure hP, ≤i [email protected] I The priority of a parent is ≥ that of its children (for a Review: Treaps max heap.) Tries Hash Tables I The largest priority is at the root. Bibliography 23 11 14 7 1 6 13 ECE750-TXB Review: Treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. I In a treap, nodes contain a pair (k, p) where k ∈ K is a Veldhuizen [email protected] key, and p ∈ P is a priority. Review: Treaps I A Treap is a mixture of a binary search tree and a heap: Tries Hash Tables I A binary search tree with respect to keys; Bibliography I A heap with respect to priorities. (d,23) (b,11) (h,14) (a,7) (c,1) (f,6) (i,13) ECE750-TXB Review: Unique Representation Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I If the keys and priorities are unique, then treaps have the unique representation property: given a set of (k, p) Review: Treaps pairs, there is only one way to build the tree. Tries Hash Tables I For the heap property to be satisfied, there is only one (k, p) pair that can be the root: the one with the Bibliography highest priority. I The left subtree of the root will contain all keys < k, and the right subtree of the root will contain all keys > k. I Of the keys < k, the one with the highest priority must occupy the left child of the root. This then splits constructing the left subtree into two subproblems. I etc. ECE750-TXB Review: Unique Representation Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen I Example: to build a treap from {(i, 13), (c, 1), (d, 23), (b, 11), (h, 14), (a, 7), (f , 6)}, [email protected] unique choice of root: (d, 23) Review: Treaps Tries (d, 23) T Hash Tables jjjj TTTT j Bibliography {(c, 1), (b, 11), (a, 7)} {(i, 13), (h, 14), (f , 6)} I To build the left subtree, pick out the highest priority element: (b, 11). And so forth. (d, 23) T t TTTT ttt (b, 11) {(i, 13), (h, 14), (f , 6)} u KK uuu KK (a, 7) (c, 1) ECE750-TXB Review: Unique Representation Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen I Data structures with the unique representation can be [email protected] checked for equality in O(1) time by using caching (also known as memoization): Review: Treaps Tries I Implement the data structure in a purely functional style Hash Tables (a node’s fields are never altered after construction. Any changes require creating a new node.) Bibliography I Maintain a map from (key, priority, lchild, rchild) tuples to already constructed nodes. I Before constructing a node, check the cache to see if it already exists; if so, return the pointer to that node. Otherwise, construct the node and add it to the cache. I If two treaps contain the same keys, their root pointers will be equal: can be checked in O(1) time. I Checking and maintaining the cache requires additional time overhead. ECE750-TXB Review: Balance of treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I Treaps are balanced if the priorities are chosen Review: Treaps randomly. Tries Hash Tables I Recall that building a binary search tree with a random insertion order results in a tree of expected height Bibliography c log n, with c ≈ 4.311. I A treap with random priorities assigned to keys has exactly the same structure as a binary search tree created by inserting keys in descending order of priority I Descending order of priority is a random order; I Therefore treaps have expected height c log n with c ≈ 4.311. ECE750-TXB Insertion into treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I Insertion for treaps is much simpler than that for Review: Treaps red-black trees. Tries 1. Insert the (k, p) pair as for a binary search tree, by key Hash Tables alone: the new node will be placed somewhere at the Bibliography bottom of the tree. 2. Perform rotations along the path from the new leaf to the root to restore invariants: I If there is a node x whose right subchild has a higher priority, rotate left at x. I If there is a node x whose left subchild has a higher priority, rotate right at x. ECE750-TXB Insertion into treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I Example: the treap below has just had (e, 19) inserted as a new leaf. Rotations have not yet been performed. Review: Treaps (d,23) Tries Hash Tables Bibliography (b,11) (h,14) (a,7) (c,1) (f,6) (i,13) (e,19) I f has a left subchild with greater priority: rotate right at f . ECE750-TXB Insertion into treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I After rotating right at f : Review: Treaps (d,23) Tries Hash Tables (b,11) (h,14) Bibliography (a,7) (c,1) (e,19) (i,13) (f,6) I h has a left subchild with greater priority: rotate right at h. ECE750-TXB Insertion into treaps Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] I After rotating right at h: Review: Treaps (d,23) Tries Hash Tables Bibliography (b,11) (e,19) (a,7) (c,1) (h,14) (f,6) (i,13) I Heap invariant is satisfied: all done. ECE750-TXB Lecture 8: Treaps, Tries, and Hash I Treaps are easily made persistent (retain previous Tables Todd L. versions) by implementing them in a purely functional Veldhuizen style. Insertion requires duplicating at most a sequence [email protected] of nodes from the root to a leaf: an O(log n) space Review: Treaps overhead. The remaining parts of the tree are shared. Tries Hash Tables I E.g. the previous insert done in a purely functional style: Bibliography Version 2 Version 1 (d,23) (d,23) (e,19) (b,11) (h,14) (a,7) (c,1) (f,6) (i,13) ECE750-TXB Strings Lecture 8: Treaps, Tries, and Hash Tables I A string is a sequence of characters drawn from some Todd L. Veldhuizen alphabet Σ. We will often use Σ = {0, 1}: binary [email protected] strings. Review: Treaps We write Σ∗ to mean all finite strings1 composed of I Tries characters from Σ. (∗ is the Kleene closure.) Hash Tables ∗ I Σ contains the empty string . Bibliography ∗ I If w, v ∈ Σ are strings, we write w · v or just wv to mean the concatenation of w and v. I Example: given w = 010 and v = 11, w · v = 01011. hΣ∗, ·, i is an example of a monoid: a set (Σ∗) together with an associative binary operator (·) and an identity element (). For any strings u, v, w ∈ Σ∗, u · (v · w) = (u · v) · w v = v = v 1Infinite strings are very useful also: if we write a real number x ∈ [0, 1] as a binary number e.g. 0.101100101000 ··· , this is a representation of x by an infinite string from Σω. ECE750-TXB Tries Lecture 8: Treaps, Tries, and Hash Tables I Recall that we may label the left and right links of a Todd L. Veldhuizen binary tree with 0 (for left) and 1 (for right): [email protected] Review: Treaps 0 y @@ 1 yyy @@ Tries x : 0 ÓÓ ::1 Hash Tables ÓÓ : y z Bibliography I To describe a path in the tree, one can list the sequence of left/right branches to take from the root. E.g., 10 gives y, 11 gives z. I The set of all paths from the root to leaves is P◦ = {0, 10, 11} I The set of all paths from the root to leaves or internal nodes is: P• = {, 0, 1, 10, 11}, where is the empty string indicating the path starting and ending at the root. ECE750-TXB Tries Lecture 8: Treaps, Tries, and Hash Tables Todd L. Veldhuizen [email protected] ◦ Review: Treaps I The set P is prefix-free: no string is an initial segment Tries of any other string. Otherwise, there would be a path Hash Tables to a leaf passing through another leaf! Bibliography • • • I The set P is prefix-closed: if wv ∈ P , then w ∈ P also. i.e., P• contains all prefixes of all strings in P•.2 2We can define • as an operator by A• ≡ {w : wv ∈ A}. • is a closure operator. A useful fact: every closure operator has as its range a complete lattice, where meet and join are given by (X u Y )• = X • ∩ Y • and (X t Y )• = (X • ∪ Y •)•.
Recommended publications
  • Application of TRIE Data Structure and Corresponding Associative Algorithms for Process Optimization in GRID Environment
    Application of TRIE data structure and corresponding associative algorithms for process optimization in GRID environment V. V. Kashanskya, I. L. Kaftannikovb South Ural State University (National Research University), 76, Lenin prospekt, Chelyabinsk, 454080, Russia E-mail: a [email protected], b [email protected] Growing interest around different BOINC powered projects made volunteer GRID model widely used last years, arranging lots of computational resources in different environments. There are many revealed problems of Big Data and horizontally scalable multiuser systems. This paper provides an analysis of TRIE data structure and possibilities of its application in contemporary volunteer GRID networks, including routing (L3 OSI) and spe- cialized key-value storage engine (L7 OSI). The main goal is to show how TRIE mechanisms can influence de- livery process of the corresponding GRID environment resources and services at different layers of networking abstraction. The relevance of the optimization topic is ensured by the fact that with increasing data flow intensi- ty, the latency of the various linear algorithm based subsystems as well increases. This leads to the general ef- fects, such as unacceptably high transmission time and processing instability. Logically paper can be divided into three parts with summary. The first part provides definition of TRIE and asymptotic estimates of corresponding algorithms (searching, deletion, insertion). The second part is devoted to the problem of routing time reduction by applying TRIE data structure. In particular, we analyze Cisco IOS switching services based on Bitwise TRIE and 256 way TRIE data structures. The third part contains general BOINC architecture review and recommenda- tions for highly-loaded projects.
    [Show full text]
  • KP-Trie Algorithm for Update and Search Operations
    The International Arab Journal of Information Technology, Vol. 13, No. 6, November 2016 722 KP-Trie Algorithm for Update and Search Operations Feras Hanandeh1, Izzat Alsmadi2, Mohammed Akour3, and Essam Al Daoud4 1Department of Computer Information Systems, Hashemite University, Jordan 2, 3Department of Computer Information Systems, Yarmouk University, Jordan 4Computer Science Department, Zarqa University, Jordan Abstract: Radix-Tree is a space optimized data structure that performs data compression by means of cluster nodes that share the same branch. Each node with only one child is merged with its child and is considered as space optimized. Nevertheless, it can’t be considered as speed optimized because the root is associated with the empty string. Moreover, values are not normally associated with every node; they are associated only with leaves and some inner nodes that correspond to keys of interest. Therefore, it takes time in moving bit by bit to reach the desired word. In this paper we propose the KP-Trie which is consider as speed and space optimized data structure that is resulted from both horizontal and vertical compression. Keywords: Trie, radix tree, data structure, branch factor, indexing, tree structure, information retrieval. Received January 14, 2015; accepted March 23, 2015; Published online December 23, 2015 1. Introduction the exception of leaf nodes, nodes in the trie work merely as pointers to words. Data structures are a specialized format for efficient A trie, also called digital tree, is an ordered multi- organizing, retrieving, saving and storing data. It’s way tree data structure that is useful to store an efficient with large amount of data such as: Large data associative array where the keys are usually strings, bases.
    [Show full text]
  • Lecture 26 Fall 2019 Instructors: B&S Administrative Details
    CSCI 136 Data Structures & Advanced Programming Lecture 26 Fall 2019 Instructors: B&S Administrative Details • Lab 9: Super Lexicon is online • Partners are permitted this week! • Please fill out the form by tonight at midnight • Lab 6 back 2 2 Today • Lab 9 • Efficient Binary search trees (Ch 14) • AVL Trees • Height is O(log n), so all operations are O(log n) • Red-Black Trees • Different height-balancing idea: height is O(log n) • All operations are O(log n) 3 2 Implementing the Lexicon as a trie There are several different data structures you could use to implement a lexicon— a sorted array, a linked list, a binary search tree, a hashtable, and many others. Each of these offers tradeoffs between the speed of word and prefix lookup, amount of memory required to store the data structure, the ease of writing and debugging the code, performance of add/remove, and so on. The implementation we will use is a special kind of tree called a trie (pronounced "try"), designed for just this purpose. A trie is a letter-tree that efficiently stores strings. A node in a trie represents a letter. A path through the trie traces out a sequence ofLab letters that9 represent : Lexicon a prefix or word in the lexicon. Instead of just two children as in a binary tree, each trie node has potentially 26 child pointers (one for each letter of the alphabet). Whereas searching a binary search tree eliminates half the words with a left or right turn, a search in a trie follows the child pointer for the next letter, which narrows the search• Goal: to just words Build starting a datawith that structure letter.
    [Show full text]
  • Lecture 04 Linear Structures Sort
    Algorithmics (6EAP) MTAT.03.238 Linear structures, sorting, searching, etc Jaak Vilo 2018 Fall Jaak Vilo 1 Big-Oh notation classes Class Informal Intuition Analogy f(n) ∈ ο ( g(n) ) f is dominated by g Strictly below < f(n) ∈ O( g(n) ) Bounded from above Upper bound ≤ f(n) ∈ Θ( g(n) ) Bounded from “equal to” = above and below f(n) ∈ Ω( g(n) ) Bounded from below Lower bound ≥ f(n) ∈ ω( g(n) ) f dominates g Strictly above > Conclusions • Algorithm complexity deals with the behavior in the long-term – worst case -- typical – average case -- quite hard – best case -- bogus, cheating • In practice, long-term sometimes not necessary – E.g. for sorting 20 elements, you dont need fancy algorithms… Linear, sequential, ordered, list … Memory, disk, tape etc – is an ordered sequentially addressed media. Physical ordered list ~ array • Memory /address/ – Garbage collection • Files (character/byte list/lines in text file,…) • Disk – Disk fragmentation Linear data structures: Arrays • Array • Hashed array tree • Bidirectional map • Heightmap • Bit array • Lookup table • Bit field • Matrix • Bitboard • Parallel array • Bitmap • Sorted array • Circular buffer • Sparse array • Control table • Sparse matrix • Image • Iliffe vector • Dynamic array • Variable-length array • Gap buffer Linear data structures: Lists • Doubly linked list • Array list • Xor linked list • Linked list • Zipper • Self-organizing list • Doubly connected edge • Skip list list • Unrolled linked list • Difference list • VList Lists: Array 0 1 size MAX_SIZE-1 3 6 7 5 2 L = int[MAX_SIZE]
    [Show full text]
  • Efficient In-Memory Indexing with Generalized Prefix Trees
    Efficient In-Memory Indexing with Generalized Prefix Trees Matthias Boehm, Benjamin Schlegel, Peter Benjamin Volk, Ulrike Fischer, Dirk Habich, Wolfgang Lehner TU Dresden; Database Technology Group; Dresden, Germany Abstract: Efficient data structures for in-memory indexing gain in importance due to (1) the exponentially increasing amount of data, (2) the growing main-memory capac- ity, and (3) the gap between main-memory and CPU speed. In consequence, there are high performance demands for in-memory data structures. Such index structures are used—with minor changes—as primary or secondary indices in almost every DBMS. Typically, tree-based or hash-based structures are used, while structures based on prefix-trees (tries) are neglected in this context. For tree-based and hash-based struc- tures, the major disadvantages are inherently caused by the need for reorganization and key comparisons. In contrast, the major disadvantage of trie-based structures in terms of high memory consumption (created and accessed nodes) could be improved. In this paper, we argue for reconsidering prefix trees as in-memory index structures and we present the generalized trie, which is a prefix tree with variable prefix length for indexing arbitrary data types of fixed or variable length. The variable prefix length enables the adjustment of the trie height and its memory consumption. Further, we introduce concepts for reducing the number of created and accessed trie levels. This trie is order-preserving and has deterministic trie paths for keys, and hence, it does not require any dynamic reorganization or key comparisons. Finally, the generalized trie yields improvements compared to existing in-memory index structures, especially for skewed data.
    [Show full text]
  • Search Trees for Strings a Balanced Binary Search Tree Is a Powerful Data Structure That Stores a Set of Objects and Supports Many Operations Including
    Search Trees for Strings A balanced binary search tree is a powerful data structure that stores a set of objects and supports many operations including: Insert and Delete. Lookup: Find if a given object is in the set, and if it is, possibly return some data associated with the object. Range query: Find all objects in a given range. The time complexity of the operations for a set of size n is O(log n) (plus the size of the result) assuming constant time comparisons. There are also alternative data structures, particularly if we do not need to support all operations: • A hash table supports operations in constant time but does not support range queries. • An ordered array is simpler, faster and more space efficient in practice, but does not support insertions and deletions. A data structure is called dynamic if it supports insertions and deletions and static if not. 107 When the objects are strings, operations slow down: • Comparison are slower. For example, the average case time complexity is O(log n logσ n) for operations in a binary search tree storing a random set of strings. • Computing a hash function is slower too. For a string set R, there are also new types of queries: Lcp query: What is the length of the longest prefix of the query string S that is also a prefix of some string in R. Prefix query: Find all strings in R that have S as a prefix. The prefix query is a special type of range query. 108 Trie A trie is a rooted tree with the following properties: • Edges are labelled with symbols from an alphabet Σ.
    [Show full text]
  • X-Fast and Y-Fast Tries
    x-Fast and y-Fast Tries Outline for Today ● Bitwise Tries ● A simple ordered dictionary for integers. ● x-Fast Tries ● Tries + Hashing ● y-Fast Tries ● Tries + Hashing + Subdivision + Balanced Trees + Amortization Recap from Last Time Ordered Dictionaries ● An ordered dictionary is a data structure that maintains a set S of elements drawn from an ordered universe � and supports these operations: ● insert(x), which adds x to S. ● is-empty(), which returns whether S = Ø. ● lookup(x), which returns whether x ∈ S. ● delete(x), which removes x from S. ● max() / min(), which returns the maximum or minimum element of S. ● successor(x), which returns the smallest element of S greater than x, and ● predecessor(x), which returns the largest element of S smaller than x. Integer Ordered Dictionaries ● Suppose that � = [U] = {0, 1, …, U – 1}. ● A van Emde Boas tree is an ordered dictionary for [U] where ● min, max, and is-empty run in time O(1). ● All other operations run in time O(log log U). ● Space usage is Θ(U) if implemented deterministically, and O(n) if implemented using hash tables. ● Question: Is there a simpler data structure meeting these bounds? The Machine Model ● We assume a transdichotomous machine model: ● Memory is composed of words of w bits each. ● Basic arithmetic and bitwise operations on words take time O(1) each. ● w = Ω(log n). A Start: Bitwise Tries Tries Revisited ● Recall: A trie is a simple data 0 1 structure for storing strings. 0 1 0 1 ● Integers can be thought of as strings of bits. 1 0 1 1 0 ● Idea: Store integers in a bitwise trie.
    [Show full text]
  • Assignment of Master's Thesis
    CZECH TECHNICAL UNIVERSITY IN PRAGUE FACULTY OF INFORMATION TECHNOLOGY ASSIGNMENT OF MASTER’S THESIS Title: Approximate Pattern Matching In Sparse Multidimensional Arrays Using Machine Learning Based Methods Student: Bc. Anna Kučerová Supervisor: Ing. Luboš Krčál Study Programme: Informatics Study Branch: Knowledge Engineering Department: Department of Theoretical Computer Science Validity: Until the end of winter semester 2018/19 Instructions Sparse multidimensional arrays are a common data structure for effective storage, analysis, and visualization of scientific datasets. Approximate pattern matching and processing is essential in many scientific domains. Previous algorithms focused on deterministic filtering and aggregate matching using synopsis style indexing. However, little work has been done on application of heuristic based machine learning methods for these approximate array pattern matching tasks. Research current methods for multidimensional array pattern matching, discovery, and processing. Propose a method for array pattern matching and processing tasks utilizing machine learning methods, such as kernels, clustering, or PSO in conjunction with inverted indexing. Implement the proposed method and demonstrate its efficiency on both artificial and real world datasets. Compare the algorithm with deterministic solutions in terms of time and memory complexities and pattern occurrence miss rates. References Will be provided by the supervisor. doc. Ing. Jan Janoušek, Ph.D. prof. Ing. Pavel Tvrdík, CSc. Head of Department Dean Prague February 28, 2017 Czech Technical University in Prague Faculty of Information Technology Department of Knowledge Engineering Master’s thesis Approximate Pattern Matching In Sparse Multidimensional Arrays Using Machine Learning Based Methods Bc. Anna Kuˇcerov´a Supervisor: Ing. LuboˇsKrˇc´al 9th May 2017 Acknowledgements Main credit goes to my supervisor Ing.
    [Show full text]
  • Balanced Binary Search Trees 1 Introduction 2 BST Analysis
    csce750 — Analysis of Algorithms Fall 2020 — Lecture Notes: Balanced Binary Search Trees This document contains slides from the lecture, formatted to be suitable for printing or individ- ual reading, and with some supplemental explanations added. It is intended as a supplement to, rather than a replacement for, the lectures themselves — you should not expect the notes to be self-contained or complete on their own. 1 Introduction CLRS 12, 13 A binary search tree is a data structure that supports these operations: • INSERT(k) • SEARCH(k) • DELETE(k) Basic idea: Store one key at each node. • All keys in the left subtree of n are less than the key stored at n. • All keys in the right subtree of n are greater than the key stored at n. Search and insert are trivial. Delete is slightly trickier, but not too bad. You may notice that these operations are very similar to the opera- tions available for hash tables. However, data structures like BSTs remain important because they can be extended to efficiently sup- port other useful operations like iterating over the elements in order, and finding the largest and smallest elements. These things cannot be done efficiently in hash tables. 2 BST Analysis Each operation can be done in time O(h) on a BST of height h. Worst case: Θ(n) Aside: Does randomization help? • Answer: Sort of. If we know all of the keys at the start, and insert them in a random order, in which each of the n! permutations is equally likely, then the expected tree height is O(lg n).
    [Show full text]
  • Tries and String Matching
    Tries and String Matching Where We've Been ● Fundamental Data Structures ● Red/black trees, B-trees, RMQ, etc. ● Isometries ● Red/black trees ≡ 2-3-4 trees, binomial heaps ≡ binary numbers, etc. ● Amortized Analysis ● Aggregate, banker's, and potential methods. Where We're Going ● String Data Structures ● Data structures for storing and manipulating text. ● Randomized Data Structures ● Using randomness as a building block. ● Integer Data Structures ● Breaking the Ω(n log n) sorting barrier. ● Dynamic Connectivity ● Maintaining connectivity in an changing world. String Data Structures Text Processing ● String processing shows up everywhere: ● Computational biology: Manipulating DNA sequences. ● NLP: Storing and organizing huge text databases. ● Computer security: Building antivirus databases. ● Many problems have polynomial-time solutions. ● Goal: Design theoretically and practically efficient algorithms that outperform brute-force approaches. Outline for Today ● Tries ● A fundamental building block in string processing algorithms. ● Aho-Corasick String Matching ● A fast and elegant algorithm for searching large texts for known substrings. Tries Ordered Dictionaries ● Suppose we want to store a set of elements supporting the following operations: ● Insertion of new elements. ● Deletion of old elements. ● Membership queries. ● Successor queries. ● Predecessor queries. ● Min/max queries. ● Can use a standard red/black tree or splay tree to get (worst-case or expected) O(log n) implementations of each. A Catch ● Suppose we want to store a set of strings. ● Comparing two strings of lengths r and s takes time O(min{r, s}). ● Operations on a balanced BST or splay tree now take time O(M log n), where M is the length of the longest string in the tree.
    [Show full text]
  • Lecture Notes of CSCI5610 Advanced Data Structures
    Lecture Notes of CSCI5610 Advanced Data Structures Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong July 17, 2020 Contents 1 Course Overview and Computation Models 4 2 The Binary Search Tree and the 2-3 Tree 7 2.1 The binary search tree . .7 2.2 The 2-3 tree . .9 2.3 Remarks . 13 3 Structures for Intervals 15 3.1 The interval tree . 15 3.2 The segment tree . 17 3.3 Remarks . 18 4 Structures for Points 20 4.1 The kd-tree . 20 4.2 A bootstrapping lemma . 22 4.3 The priority search tree . 24 4.4 The range tree . 27 4.5 Another range tree with better query time . 29 4.6 Pointer-machine structures . 30 4.7 Remarks . 31 5 Logarithmic Method and Global Rebuilding 33 5.1 Amortized update cost . 33 5.2 Decomposable problems . 34 5.3 The logarithmic method . 34 5.4 Fully dynamic kd-trees with global rebuilding . 37 5.5 Remarks . 39 6 Weight Balancing 41 6.1 BB[α]-trees . 41 6.2 Insertion . 42 6.3 Deletion . 42 6.4 Amortized analysis . 42 6.5 Dynamization with weight balancing . 43 6.6 Remarks . 44 1 CONTENTS 2 7 Partial Persistence 47 7.1 The potential method . 47 7.2 Partially persistent BST . 48 7.3 General pointer-machine structures . 52 7.4 Remarks . 52 8 Dynamic Perfect Hashing 54 8.1 Two random graph results . 54 8.2 Cuckoo hashing . 55 8.3 Analysis . 58 8.4 Remarks . 59 9 Binomial and Fibonacci Heaps 61 9.1 The binomial heap .
    [Show full text]
  • CMSC 420: Lecture 7 Randomized Search Structures: Treaps and Skip Lists
    CMSC 420 Dave Mount CMSC 420: Lecture 7 Randomized Search Structures: Treaps and Skip Lists Randomized Data Structures: A common design techlque in the field of algorithm design in- volves the notion of using randomization. A randomized algorithm employs a pseudo-random number generator to inform some of its decisions. Randomization has proved to be a re- markably useful technique, and randomized algorithms are often the fastest and simplest algorithms for a given application. This may seem perplexing at first. Shouldn't an intelligent, clever algorithm designer be able to make better decisions than a simple random number generator? The issue is that a deterministic decision-making process may be susceptible to systematic biases, which in turn can result in unbalanced data structures. Randomness creates a layer of \independence," which can alleviate these systematic biases. In this lecture, we will consider two famous randomized data structures, which were invented at nearly the same time. The first is a randomized version of a binary tree, called a treap. This data structure's name is a portmanteau (combination) of \tree" and \heap." It was developed by Raimund Seidel and Cecilia Aragon in 1989. (Remarkably, this 1-dimensional data structure is closely related to two 2-dimensional data structures, the Cartesian tree by Jean Vuillemin and the priority search tree of Edward McCreight, both discovered in 1980.) The other data structure is the skip list, which is a randomized version of a linked list where links can point to entries that are separated by a significant distance. This was invented by Bill Pugh (a professor at UMD!).
    [Show full text]