What is the running time of the algorithm


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 give formatting requirements:

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

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

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

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: What is the running time of the algorithm
Reference No:- TGS03091474

Expected delivery within 24 Hours