This preview shows pages 1–3. Sign up to view the full content.
6.851: Advanced Data Structures
Spring 2010
Lecture 4 — February 11, 2010
Prof. Andr´
e Schulz
Scribe: Peter Caday
1
Overview
In the previous lecture, we studied range trees and kdtrees, two structures which support efcient
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
. ±or 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
((log
n
)
T
b
/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
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document3
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 eFciently 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
. Thos to the left and to the right can be dealt with recursively.
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '10
 ErikDemaine
 Data Structures

Click to edit the document details