MIT6_851S10_lec04 - 6.851: Advanced Data Structures Spring...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 kd-trees, 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 kd-tree, 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 divide-and-conquer 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

Page1 / 8

MIT6_851S10_lec04 - 6.851: Advanced Data Structures Spring...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online