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 kd-trees, 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 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
((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