Docsity

Computational Geometry Assignment 3: Reducing Storage in Point Location, Assignments of Algorithms and Programming

Toggle sidebar
bg1
CS 5160/6160: Computational Geometry Feb 19, 2009
Assignment 3
DUE DATE: Mar 5, 2009
3.1 Recursive Point Location (25)
The slab method for point location described in class uses O(n2)storage. In this assignment,
we will investigate how we might reduce storage without changing the query time.
We start by stating (without proof) the existence of a certain data structure. Let r1,...rnbe
a set of items drawn from an ordered universe R. These items divide Rinto intervals, where
Ii= (ri, ri+1). Associate a weight wiwith each interval. Let W=Pwi.
Lemma 3.1.1 ([]).For any weighted sequence as described above, there exists a search tree with
interior nodes corresponding to the ri’s (1≤i≤n) and leaves corresponding to the intervals Ii
such that for any i, the length of the path from the root to the leaf Iiis 2 + log(W/wi).
The intuition behind this is that items with high weight (you can think of wi/W as the “proba-
bility” of accessing i) will appear higher in the tree than items with low weight, so the average
query time remains small (this has the flavor of a Huffman code).
We’re now ready to modify the slab algorithm.
1. Rather than building search structures on each of the O(n)slabs, suppose we divided
the slabs into √ngroups, each of size √n. We can use a simple binary search to find
which group the point lies in. Within each group, some segments completely intersect it,
breaking the slab into trapezoids. Each trapezoid is partially intersected by some other
segments; build a slab data structure on each trapezoid, and use a weighted search tree
to locate the right trapezoid to consider (HINT: Choose as weight e2
j, where ejis the
number of segments that intersect a trapezoid.
Show that this data structure uses O(n3/2)space while requiring a query time of 3
2log n.
Note the constants! Don’t reduce query time via O() notation.
2. How far can we go ? Show by repeated recursive calls, you can get a data structure whose
space requirement is o(n1+ε), while still taking only O(log n)time per query.
3.2 Rectangular Point Location (20)
Given a collection of naxis-parallel rectangles in the plane, construct a data structure that
answers queries of the form, “Given a point p, return all rectangles that contain p”. Find the
3-1
pf3

Partial preview of the text

Download Computational Geometry Assignment 3: Reducing Storage in Point Location and more Assignments Algorithms and Programming in PDF only on Docsity!

CS 5160/6160: Computational Geometry Feb 19, 2009

Assignment 3

DUE DATE: Mar 5, 2009

3.1 Recursive Point Location (25)

The slab method for point location described in class uses O(n^2 ) storage. In this assignment, we will investigate how we might reduce storage without changing the query time.

We start by stating (without proof) the existence of a certain data structure. Let r 1 ,... rn be a set of items drawn from an ordered universe R. These items divide R into intervals, where Ii = (ri, ri+1). Associate a weight wi with each interval. Let W =

wi.

Lemma 3.1.1 ([]). For any weighted sequence as described above, there exists a search tree with interior nodes corresponding to the ri’s ( 1 ≤ i ≤ n) and leaves corresponding to the intervals Ii such that for any i, the length of the path from the root to the leaf Ii is 2 + log(W/wi).

The intuition behind this is that items with high weight (you can think of wi/W as the “proba- bility” of accessing i) will appear higher in the tree than items with low weight, so the average query time remains small (this has the flavor of a Huffman code).

We’re now ready to modify the slab algorithm.

  1. Rather than building search structures on each of the O(n) slabs, suppose we divided the slabs into

n groups, each of size

n. We can use a simple binary search to find which group the point lies in. Within each group, some segments completely intersect it, breaking the slab into trapezoids. Each trapezoid is partially intersected by some other segments; build a slab data structure on each trapezoid, and use a weighted search tree to locate the right trapezoid to consider ( HINT: Choose as weight e^2 j , where ej is the number of segments that intersect a trapezoid. Show that this data structure uses O(n^3 /^2 ) space while requiring a query time of 32 log n. Note the constants! Don’t reduce query time via O() notation.

  1. How far can we go? Show by repeated recursive calls, you can get a data structure whose space requirement is o(n1+ε), while still taking only O(log n) time per query.

3.2 Rectangular Point Location (20)

Given a collection of n axis-parallel rectangles in the plane, construct a data structure that answers queries of the form, “Given a point p, return all rectangles that contain p”. Find the

Assignment 3: Feb 19, 2009 3-

Trapezoids formed within the slab

Segments within a trapezoid

Figure 3.1: A Single Slab

best structure possible; you should use o(n) query time, o(n^2 ) space, and o(n^2 ) preprocessing. Points will be awarded based on the asymptotic quality of the solution.

3.3 Rectangle-Polygon Queries (15)

This is problem 5.13(b) from the textbook.

Let S be a set of n polygons in the plane. Describe a data structure that uses O(n log^3 n) storatge and takes O(log^4 n + k) query time to report all polygons completely contained in the query rectangle, where k the number of reported answers.

3.4 Range Counting (20)

This is problem 10.6 from the textbook

Let I be a set of intervals on the real line. We want to be able to count the number of intervals containing a query point in O(log n) time. Specificaly, the query time is independent of the number of segments containing the query point.

  1. Give a segment tree-based structure for this problem that uses O(n) storage. Give bounds for preprocessing and query time.
  2. Do the same with interval trees (you’ll have to modify the list structures used with inter- val trees). Analyze the B/S/Q parameters.
  3. Finally, describe a structure based on binary search trees that uses O(n) space and has O(log n) query time.