Lecture 11
Computational Geometry Data Structures: Range Searching

In this lecture we look at a class of computational geometry data structures used for orthogonal range searching. Given a set of d-dimensional points, we are asked to find all points that are inside of a d-dimensional range (a rectangle in two dimensions).

Two data structures are discussed—the kd-tree and the range tree. Analysis of these data structures show how we can trade size of a data structure for better query performance.

Goals of the lecture:
  - to understand the importance of the range searching problem;
  - to understand and to be able to analyze the kd-trees and the range trees.

Time and Location

Thursday, 4th of November, 2004 at 10:15 in E3-209

Preparation for the lecture

Read chapter 5 (until section 5.6) from M. de Berg, M. van Kreveld, M. Overmars, O. Schwarzkopf, Computational Geometry, Algorithms and Applications, Second Edition, Springer (you can find a copy in the course folder). While reading, make sure you get answers to the following questions:
  - How does the one-dimensional range searching work?
  - How is the kd-tree defined (what is its structure)?
  - How the kd-tree can be constructed in O(n log n) time?
  - What are the advantages and disadvantages of the kd-trees?
  - How is the range tree defined (what is its structure)?

Lecture slides

[power point]

Exercises

A 2-dimensional partial match query specifies a value for one of the coordinates and asks for all points that have that value for the specified coordinate. For example, x=3 is a partial match query.
  - Explain how to use a 2-dimensional range tree to answer partial match queries. What is the resulting worst-case query time?
  - Describe a data structure that uses linear storage and answers 2-dimensional partial match queries in O(log n + k) time.
Describe an algorithm to construct a d-dimensional kd-tree from a set of points. Prove that you algorithm runs in O(n log n) time.
Describe algorithms to insert and delete points from a kd-tree. In your algorithms you do not need to take care of rebalancing the structure, but note that each node in a kd-tree have to have two children (or none if it is a leaf).
A range counting query reports only the number of points that lie in a given range (instead of reporting all of them). Modify the two-dimensional range tree, so that range counting queries can be answered in O(log2 n) worst-case time (note that there is no O(k) term). You can begin by solving this problem for one-dimensional range tree.
Show that the worst-case time for a three-dimensional query on a three-dimensional kd-tree is O(n2/3 + k).

Last updated Nov 7, 2004, Simonas Saltenis