This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 6.851: Advanced Data Structures Spring 2010 Lecture 4 February 11, 2010 Prof. Andr e Schulz 1 Overview In the previous lecture, we studied range trees and kdtrees, two structures which support ecient orthogonal range queries on a set of points. In this second of four lectures on geometric data structures, we will tie up a loose end from the last lecture handling insertions and deletions. The main topic, however, will be two new structures addressing the vertical line stabbing problem: interval trees and segment trees. We will conclude with an application of vertical line stabbing to a windowing problem. 2 Dynamization In our previous discussion of range trees, we assumed that the point set was static. On the other hand, we may be interested in supporting insertions and deletions as time progresses. Unfortunately, it is not trivial to modify our data structures to handle this dynamic scenario. We can, however, dynamize them using general techniques; the techniques and their application here are due to Overmars [1]. Idea. Overmars dynamization is based on the idea of decomposable searches . A search ( X, q ) for the value q among the keys X is decomposable if the search result can be obtained in O (1) time from the results of searching ( X 1 ,q ) and ( X 2 ,q ), where X 1 X 2 = X . For instance, in the 2D kdtree, the root node splits R 2 into two halves. If we want to search for all points lying in a rectangle q , we may do this by combining the results of searching for q in each half. Results. We will bypass the actual dynamization method, and just give the results. Insertion: O ( T n b log n ), where T b is the build time , the time required to build the static tree Query: time increases by a log n factor Note that this is a general result, which applies to any data structure with a decomposable search. As a concrete example, here are the times for a dynamic 2D range tree: Insertion: O (log 2 n + k ), where k is the size of the output, as always Query: O (log 2 n ) We have only mentioned insertion time here; deletions are more complicated. 1 3 Vertical line stabbing We now move to the main focus of this lecture. In the vertical line stabbing problem, the input is a collection I = { [ a 1 ,b 1 ] , [ a 2 ,b 2 ] ,... } of n closed intervals. We wish to be eciently report, for any q R , the intervals containing q . The name vertical line stabbing derives from one way to visualize the problem: q 3.1 Interval Tree Idea. One way to address the problem is through a divideandconquer approach. Consider the median m of the 2 n endpoints in I . Some intervals may lie entirely to the left of m , some entirely to the right, and some may cross m . Those to the left and to the right can be dealt with recursively....
View
Full
Document
 Spring '10
 ErikDemaine
 Data Structures

Click to edit the document details