Describe how to build an efficient data structure


Assignment: Computer Geographics

i. In this chapter we have looked at the point location problem with pre- processing. We have not looked at the single shot problem, where the subdivision and the query point are given at the same time, and we have no special preprocessing to speed up the searches. In this exercise and some of the following ones, we have a look at such problems.

Given a simple polygon P with n vertices and a query point q, here is an algorithm to determine whether q lies in P. Consider the ray ρ := {(qx +λ,qy) : λ > 0} (this is the horizontal ray starting in q and going rightwards). Determine for every edge e of P whether it intersects ρ. If the number of intersecting edges is odd, then q ∈ P, otherwise q à∈ P.

Prove that this algorithm is correct, and explain how to deal with degen- erate cases. (One degenerate case is when ρ intersects an endpoint of an edge. Are there other special cases?) What is the running time of the algorithm?

ii. Suppose you are given an n-vertex simple polygon, P. Describe how to build an efficient data structure for determining in O(log n) time whether a query point, q, is inside of P or not. What is the space and preprocessing time for your data structure?

iii. The ray shooting problem occurs in computer graphics (see Chapter 8). A 2-dimensional version can be given as follows: Store a set S of n non-crossing line segments such that one can quickly answer queries of the type: "Given a query ray ρ-a ray is a half-line starting at some point-find the first segment in S intersected by ρ." (We leave it to you to define the behavior for degenerate cases.) In this exercise, we look at vertical ray shooting, where the query ray must be a vertical ray pointing upwards. Only the starting point need be specified in such a query. Give a data structure for the vertical ray shooting problem for a set S of n non-crossing line segments in general position. Bound the query time and storage requirement of your data structure. What is the preprocessing time?

Format your assignment according to the following formatting requirements:

i) The answer should be typed, using Times New Roman font (size 12), double spaced, with one-inch margins on all sides.

ii) The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

iii) Also include a reference page. The Citations and references must follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Describe how to build an efficient data structure
Reference No:- TGS03091247

Now Priced at $110 (50% Discount)

Recommended (95%)

Rated (4.7/5)