COS 226 PROBLEM SET 7

1. Give the points that appear on the trial hull (in the order that they appear) when the Graham scan is used to find the convex hull of the points (6,3) (5,6) (8,2) (2,4) (3,9) (1, 1) and (1,6).







2. Draw the 2D tree that results when the points (2,1) (5,6) (8,2) (6,3) (4,7) (3,9) and (1,4) are inserted in the order given into an initially empty tree.







3. Give an ordering of the points in the previous problem that causes the resulting 2D tree to be degenerate.




4. Give the sequence of trees, in the style of Figure 27.4, produced by the horizontal-vertical line intersection routine when run on the lines (2,1)---(2,5), (1,6)---(6,6), (3,3)---(3,4), and (5,2)---(5,7). Name the lines A, B, C, and D respectively.







5. Suppose that you add a function to Program 3.20 that can count the number of points within a distance r of a given test point (not necessarily in the original set), using the compound data structure that is built by Program 3.20. Estimate the number of points examined for each query, as a function of N, d, and r.





Due: in precept on April 12 or 13.

Do your work on this page (use the back if you must)