Вы находитесь на странице: 1из 1

AMS 345/CSE 355 (Spring, 2006) Joe Mitchell

COMPUTATIONAL GEOMETRY
Homework Set # 4
Due at the beginning of class on Wednesday, March 8, 2006.
Recommended Reading: O’Rourke, Chapter 3 (sections 3.1–3.8).
Reminders: The Midterm Exam will be March 15th, 3:50-5:10PM. It will cover material from home-
works 1–4.
In all of the exercises, be sure to give at least a brief explanation or justification for each claim that you
make.
(1). [20 points] O’Rourke, problem 4, section 3.2.3, page 68.
(2). [20 points] O’Rourke, problem 5, section 3.4.1, page 72.
(3). [15 points] O’Rourke, problem 3, section 3.5.7, page 86. Explain. How many iterations of the while
loop are there?
(4). [20 points] Let S be the set of points {(3,1), (4,4), (5,-1), (2,-1), (2,2), (2,1), (4,-1), (6,1), (8,1), (8,5),
(7,4), (3,3)}. When the Graham Scan code of Section 3.5 is run on this data, what is the sorting (as in Table
3.1) and what is the history of the stack (as in the example on page 86)? Plot the points and the resulting
convex hull.
(5). [15 points] Assume that we execute Melkman’s convex hull algorithm on the vertices of the chain shown
below in the order v0 , v1 , v2 , v3 , etc. (In the figure, I label vi with “i”.) Show the deque, indicating the
“top” dt and “bottom” db at the instant just after having computed the hull of the first 8 vertices (v 0 –v7 )
and also just after the first 9 vertices (v0 –v8 ).
11

10
12
13

14

8 9

3 0
7

4
5
6

(6). [10 points] The algorithm below is proposed to find the convex hull of a simple polygon P that has n
vertices, in O(n) time. The goal is to avoid the need to sort, by using the order given by the vertices of P ,
which are assumed to be given in clockwise order around the boundary of P . The algorithm is essentially
just doing a variant of the Graham Scan, using the order of the vertices about P in the incremental insertion.
Show that this algorithm can fail by finding a counterexample in which the output is erroneous.
Algorithm: Let the stack Q be initialized as (q0 , q1 ), where q0 is the leftmost point of the polygon and q1
is the (clockwise) successor of q0 in the list of points of the polygon. March around the polygon (clockwise),
starting with the successor of q1 . If at some stage the stack is Q = (q0 , . . . , qi ), with i ≥ 1, then let p be the
successor of qi . If (qi−1 , qi , p) is a right turn, then push p onto the stack Q; otherwise, pop Q (and continue
popping Q) until this right-turn condition is satisfied or until there is only one point remaining in the stack,
and then push p onto Q. Stop when you return to point q0 .

Вам также может понравиться