




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!





CS 573: Topics in Algorithms: Advanced Data Structures Spring 2006
Lecturer: Jeff Erickson Scribe: Tracy Grauman
Up until now, we have been talking about maintaining data structures which could handle such familiar requests as asking it a query or requesting that it change its structure in some discrete way. Now we are going to change our focus to look at kinetic data structures, which change continuously. Basch*, Guibas, and Hershberger [1],[4] were the first ones to nail down the general rules for kinetic data structures in that paper.
Evaluation Criteria for Kinetic Data Structures
Consider supporting two queries to a kinetic dictionary,
Find(t, x): Asks “Is there a node whose value at time t is equal to x?”
Update(t, v, y): Change function at node v to y : R → R, where the value of the function of node v at time t, xv(t) = y(t).
We want to store our binary search tree, where the keys are functions. At any instant, the tree should be in sorted order. That is, for an adjacent pair (xi, xi+1), xi < xi+1. We want to compute the first moment, t, when this inequality doesn’t hold. Thus, maintain in a priority queue the result of the following function:
t(xi, xi+1) = min{t|xi(t) ≥ xi+1(t)}
(Note: Strictly speaking, we should use “infimum” instead of “minimum.”)
When this happens, surgery is needed on our binary tree, resolved by reassigning parent- child pointers. We must make one of two assumptions: either that at most one event happens at any instant or that we have a mechanism for ordering concurrent events.
Event: //(xi, xi+1) expired swap xi and xi+1 in binary search tree insert xi+1, xi) with new certificate update certificates for (xi+1, x + i) and (xi+1, xi+2) As mentioned, the evaluation of efficiency can be a fuzzy area, and here we have one example of this. In one way, our algorithm is very efficient, as it only does necessary updates. On the other hand, if we never ask the structure any queries, then we never really need to keep the structure up-to-date, making any updates arguably “inefficient.”
Maintain Entire Sorted Order
We could maintain the entire sorted order of all our elements. Clearly, though, this is simply not efficient, as the maximum number of changes is O(
(n 2
Keep Track of the Upper Hull
Assuming we know all of our functions in advance, we could plot them on a graph and look at the upper hull of the graph. However, if one of the functions should change its trajectory, we may have to recalculate the upper hull, a costly operation.
Figure 11.2. A kinetic heap and its comparisons
Proving the Efficiency of Kinetic Heaps
Let Φ(t) be the number of potential events which could occur in a tree t. Then
v number of proper ancestors of v = number of edges in transitive closure Let ∆(t, x) be the number of descendants of x at time t that will overtake x in the future (that is, at time ≥ t), and let ∆(t) =
x ∆(t, x). Trivially, ∆(t) is at most the number of descendants of x, so ∆(t) ≤ Φ(t).
Let ∆(t, x, y) be the number of descendants of y at time t that will overtake x at time > t. Then ∆(t, x) =
child y of x ∆(t, x, y).
Finally, let t−^ be the old potential of y and let t+^ be the new potential of y.
Consider the following parent-child relationship of nodes x and y, which has the potential to change. The new potential of y after the change can be defined in terms terms of the old potential of x. Also notice that if a descendent of y should overtake y in the future, it must also overtake x in the future.
Suppose at time t, x(t) = y(t) for some x = parent(y).
∆(t−, z) = ∆(t+, z) for all z 6 = x, y ∆(t+, x) = ∆(t−, x, y) − 1 after swap ∆(t+, y) ≤ ∆(t−, y) +
z ∆(t
−, x, z), where z are children of x (before swap), z 6 = y ≤ ∆(t−, y) + ∆(t−, x) − ∆(t−, x, y)
Thus, ∆(t+) ≤ ∆(t−) − 1; that is, every event decreases the potential by 1. We started with potential Φ(t), and thus the number of events after time t is ≤ ∆(t) ≤ Φ(t).
Therefore in the linear-motion case, our efficiency is O(nlog n). Unfortunately, this analy- sis doesn’t work for higher-order motion.
Heater [2]
The basic idea of a heater is to give every object a random key, and keep the keys sorted left to right. In some ways, the data structure is akin to a reverse heap – a node has a priority but also a random search key. A good implementation of a heater is as a binary search tree. Its depth will be O(log n) with high probability. Note also that it is difficult both to split a heater or to merge two heaters.
Hanger [3]
A hanger is built from scratch from the empty set, inserting elements in decreasing order of priorities and using a random coin flip to decide whether to put the element in a left or right subtree. As opposed to heaters, the operations of splitting a tree or merging two trees are trivial to hangers.
Given a set of points in the plane, the closest pair of points can be computed in O(n log n) by using a Voronoi diagram. However, how can one maintain which pair is the closest as the points move around in the plane? There are potentially Ω(n^2 ) changes of which pair is the closest, as illustrated by figure 11.3.
Figure 11.3. If set A moves left, n^2 comparisons will be made with set B
If one considers maintaining the Voronoi diagram, we have a solution that is indeed compact, local-ish (one cell may be complicated, but on average will be O(1)), and responsive. However, its efficiency is Ω(n^2 ) and has thus far been proven to be O(n3+≤) [Micah-Sharir].
The Yao Graph, Y (P ), is a directed graph with ≤ 6 n edges, where closest pairs create edges. We create this graph by partitioning the plane into six wedges using three lines through a point p which meet at 60◦^ angles. Then “neighbors” of p are found by drawing equilateral triangles in each wedge such that every triangle contains only one other point besides p. We will show the algorithm for maintaining closest pairs for one wedge, and the procedure for other wedges follows symmetrically.
Change of y-coordinate
Find and split and merge, all in O(log n) time.
Figure 11.7. Change of y-coordinate
Change of 60◦-coordinate
Figure 11.8. Change of 60◦-coordinate
Analysis
As a final note, Yao Graphs can be generalized to higher dimensions, though not all cases have been analyzed. For example, in three dimensions, one can consider maintaining on the order of twenty pyramids in place of maintaining six triangles.
[1] Julien Basch*, Leonidas Guibas, and John Hershberger. Data structures for mobile data. J. Algorithms 31(1):1-28, 1999.
[2] Julien Basch, Leonidas Guibas, and G. D. Ramkumar. Reporting red-blue intersec- tions between two sets of conencted line segments. Algorithmica 35:1-20, 2003.
[3] Guilherme D. da Fonseca* and Celina M. H. de Figueiredo. Kinetic heap-ordered trees: tight analysis and faster algorithms. Information Processing Letters 85(3):165-169, 200
[4] Leonidas Guibas. Kinetic data structures. Chapter 23 of Handbook of Data Structures and Applications (Dinesh P. Mehta and Sartaj Sahni, eds.), 23-123-18. Chapman and Hall/CRC, 2005.