




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































1 1. Temporal data structure 1 4
Scribers: Oscar Moll (2012), Aston Motes (2007), Kevin Wang (2007) 1.1 Overview.......................................... 4 1.2 Model and definitions................................... 4 1.3 Partial persistence..................................... 6 1.4 Full persistence....................................... 9 1.5 Confluent Persistence.................................... 12 1.6 Functional persistence................................... 13
2 2. Temporal data structure 2 14
Scribers: Erek Speed (2012), Victor Jakubiuk (2012), Aston Motes (2007), Kevin Wang (2007) 2.1 Overview.......................................... 14 2.2 Retroactivity........................................ 14
3 3. Geometric data structure 1 24
Scribers: Brian Hamrick (2012), Ben Lerner (2012), Keshav Puranmalka (2012) 3.1 Overview.......................................... 24 3.2 Planar Point Location................................... 24 3.3 Orthogonal range searching................................ 27 3.4 Fractional Cascading.................................... 33
4 4. Geometric data structure 2 35
Scribers: Edward Z. Yang (2012), Katherine Fang (2012), Benjamin Y. Lee
Scribers: Karan Sagar (2012), Jacob Hurwitz (2012), Jingjing Liu (2010),
Scribers: Leon Bergen (2012), Andrea Lincoln (2012), Tana Wattanawaroon
8.2 Conceptual binary tree showing how to build the intervals. If we insert a new element in a leaf and there is not enough room for it and interval is too dense (showed in light gray), we are going to walk up the tree and look at a bigger interval (showed in dark gray) until we find the right interval. In the end we at most get to the root which means redistribution of the the entire array................... 69 8.3 A cache-oblivious priority queue............................. 71
Lecture 9 9.1 Memory layout for K-funnel sort.............................. 74 9.2 Filling a buffer........................................ 75 9.3 Left and Right slabs containing points and rectangles.................. 76 9.4 Slabs that also contain slabs that span either L or R................... 77 9.5 Depicts the three different types of range queries..................... 77 9.6 A high level description of the datastructure which supports 2 sided range queries using only linear space................................... 78 9.7 An example showing how our first attempt may construct an array with size quadratic in N.............................................. 79
Lecture 10
Lecture 11 11.1 A visual representation of the recursive structure of a VEB. Note that at each level, the minimum is stored directly, and not recursively.................... 95
Lecture 12 12.1 An example of the sketch function with 4 keys. The levels corresponding to the 3 bits sketched are circled................................... 100 12.2 An example when the search query is not among the keys of the fusion node. The paths to the keys are bolded, whereas the path to the query q is dashed; the levels corresponding to the bits sketched are circled as before. Here, the sketch neighbours of q are x 0 and x 1 , but x 0 is neither a predecessor nor successor of q.......... 101
Lecture 13
Lecture 14
Lecture 15
Lecture 16 16.1 On the left we have node v with 5 children. Each triangle represents a subtree, and the size of the triangle represents the weight of the subtree (the number of descendand leaves of the subtree). On the right we can see the weight balanced BST. The solid lines are the edges of the weight balanced BST and the dashed lines represent the initial edges to the children of v....................... 131
Lecture 17 17.1 i − 1 and i are on the same level.............................. 142 17.2 i − 1 and i are different levels................................ 142 17.3 Division of bit string into chunks and sub-chunks, as in the rank algorithm..... 144 17.4 Division of bit string into uneven chunks each containing the same number of 1’s, as in the select algorithm................................... 145 17.5 An example binary trie with circled right spine...................... 146 17.6 A Rooted Ordered Tree That Represents the Trie in Figure 17.5............ 147 17.7 A Balanced Parentheses String That Represents the Ordered Tree in Figure 17.6.. 147
Lecture 18
Lecture 19
Lecture 20 20.1 An example tree and its Euler tour. The order in which nodes in the tree are visited is indicated by the curved red arrows. The Euler tour of the tree shown here corresponds to the sequence: R A R B C D C E C B F B G B R.......... 166 20.2 We represent a tree’s Euler tour as a sequence of visitations starting and ending at the root. Pointers from that sequence point to the node, and pointers from the node point to the first and last visitations. In this figure only the pointers relating to the root are shown........................................ 167
Lecture 21 21.1 A √n by √n grid of vertices, with one of the disjoint paths darkened......... 173
Scribes: Oscar Moll (2012), Aston Motes (2007), Kevin Wang (2007)
1.1 Overview
In this first lecture we cover results on persistent data structures, which are data structures where we keep all information about past states. Persistent data structures are part of the larger class of temporal data structures. The other kind of temporal data structures, retroactive data structures, are the topic of lecture 2. Usually we deal with data structure updates by mutating something in the existing data structure: either its data or the pointers that organize it. In the process we lose information previous data structures states. Persistent data structures do not lose any information. For several cases of data structures and definitions of persistence it is possible to transform a plain data structure into a persistent one with asymptotically minimal extra work or space overhead. A recurring theme in this area is that the model is crucial to the results. Partial and full persistence correspond to time travel with a branching universe model such as the one in Terminator, and Deja Vu parts 1 and 2
1.2 Model and definitions
In this model we think of data structures as collections of nodes of a bounded size with entries for data. Each piece of data in the node can be either actual data, or a pointer to a node. The primitive operations allowed in this model are:
Where x, y, z are names of nodes or fields in them. Data structures implementable with these shape constraints and these operations includes linked lists and binary search trees, and in general corresponds to struct’s in C or objects in Java. An example of a data structure not in this group would be a structure of variable size such as an array.
We have vaguely referred to persistence as the ability to answer queries about the past states of the structure. Here we give several definitions of what we might mean by persistence.
The difference between functional persistence and the rest is we have to keep all the structures related to previous versions intact: the only allowed internal operation is to add new nodes. In the previous three cases we were allowed anything as long as we were able to implement the interface. Each of the succeeding levels of persistence is stronger than the preceding ones. Functional implies confluent, confluent implies full, and full implies partial. Functional implies confluent because we are simply restricting ways on how we implement persis- tence. Confluent persistence becomes full persistence if we restrict ourselves to not use combinators. And full persistence becomes partial when we restrict ourselves to only write to the latest version.
14
For an illustration of the construction check figures 1.2a and 1.2b We implement read and write operations as follows:
For some data structures such as lists or trees we often know what p is ahead of time, so we can implement the algorithm for these specific structures like in figure 1.3.
(cost(x))
Where c represents the O(1) cost of determining latest versions to copy into the new node, copying backpointers, etc. x → n stands for x points to n. Clearly the cost can be large because we could split many data nodes in the recursive steps. However, we know when a node becomes full then next operation will likely find a more empty
16
(a) Ephemeral linked structure. It has one data field and one pointer field
(b) The structure in 1.2a partially persistent. Showing one update: write(root.ptr.val = 20)
(c) The structure in 1.2b after a second update: write(root.ptr.val = 200). Gray indicates the data node is read only
Figure 1.2: Constructing a partially persistent structure from an ephemeral one
The version representation problem is solved by keeping a tree representing the version structure, as well as an efficient representation of this tree in a linearized way. The linearized representation of the tree in the figure 1.4 is ba, bb, bc, ec, eb, bd, ed, ea. You can read ba as ‘begin node a’ and ea as ‘end node a’. This representation losslessly encodes the tree, and we can directly answer queries about the tree using that encoded representation. For example we know c is nested within b, since bb < bc and ec < eb.
Figure 1.4: in-order tree traversal
This linearized representation can be implemented using an ‘order maintenance’ data structure. For now, it suffices to say an order maintenance data structure supports the following two operations, both in O(1) time.
For example, a linked list supports insertions in O(1), but tests for precedence take O(n). Similarly, a balanced BST supports both operations but in O(log n) time. Deitz and Sleator show an O(1) implementation for both operations in [4], which will be covered in lecture 8. To implement version tree queries such as ‘is version v an ancestor of version w’ we can use two comparison queries bv < bw and ew < ev in O(1). To implement updates like ‘add version v as a child of version w’ we can insert the two elements bv and ev after bw and before ew respectively, also in O(1).
The nodes in our data structure will keep the same kinds of additional data per node as they did in the partially persistent case.
19
Figure 1.5: Splitting a tree-shaped version genealogy into two subtrees
For each node we store d data entries and p back pointers, but now allow up to 2(d + p + 1) modifications. The amount of data d is also a bound on out-pointers per node. Additionally we now also version back-pointers.
20