Docsity

Assignment #4 - Design Analysis of Algorithms | COMP 482, Assignments of Algorithms and Programming

Toggle sidebar
bg1
COMP 482, Fall 2008, Assignment 4
1. (15 points – 10 points part a, 5 points part b) [CLRS] 33-5
Consider the problem of computing the convex hull of a set of points in the plane that
have been drawn according to some known random distribution. Sometimes, the number of
points, or size, of the convex hull of npoints drawn from such a distribution has expectation
O(n1−) for some constant > 0. We call such a distribution sparse-hulled. Sparse-hulled
distributions include the following:
•Points drawn uniformly from a unit-radius disk. The convex hull has Θ(n1/3) expected
size.
•Points drawn uniformly from the interior of a convex polygon with ksides, for any
constant k. The convex hull has Θ(lg n) expected size.
•Points drawn according to a two-dimensional normal distribution. The convex hull has
Θ(√lg n) expected size.
(a) Given two convex polygons with n1and n2vertices respectively, show how to compute
the convex hull of all n1+n2points in O(n1+n2) time. (The polygons may overlap.)
(b) Show that the convex hull of a set of npoints drawn independently according to a sparse-
hulled distribution can be computed in O(n) expected time. (Hint: Recursively find the
convex hulls of the first n/2 points and the second n/2 points, and then combine the
results.)
2. (15 points – 5 points each part)
(a) Similar to part (a) of the previous problem, given kconvex polygons, not necessarily
disjoint, with overall nvertices, show how to compute their convex hull in O(kh +n)
time, where his the number of vertices in the convex hull.
(b) Given a npoints on the plane, show how to compute their convex hull in O(nlog g) time,
assuming you know a priori the number gof vertices on the convex hull.
(c) Assume you have a solution to part(b). We can combine that with superexponential
search to get another convex hull algorithm.
Let g= 220,221,222,..., in turn. Run the algorithm from part (b), but for at most
cn log gsteps. (cis a constant which is large enough for the algorithm to terminate
when g≥h. Its value and how to find such a care not our present concern.) If a convex
hull was found, return it, otherwise proceed with the next larger value of g.
This algorithm is correct, since a large enough gguarantees success. What is its asymp-
totic running time?
1

Partial preview of the text

Download Assignment #4 - Design Analysis of Algorithms | COMP 482 and more Assignments Algorithms and Programming in PDF only on Docsity!

COMP 482, Fall 2008, Assignment 4

  1. (15 points – 10 points part a, 5 points part b) [CLRS] 33-

Consider the problem of computing the convex hull of a set of points in the plane that have been drawn according to some known random distribution. Sometimes, the number of points, or size, of the convex hull of n points drawn from such a distribution has expectation O(n^1 −) for some constant  > 0. We call such a distribution sparse-hulled. Sparse-hulled distributions include the following:

  • Points drawn uniformly from a unit-radius disk. The convex hull has Θ(n^1 /^3 ) expected size.
  • Points drawn uniformly from the interior of a convex polygon with k sides, for any constant k. The convex hull has Θ(lg n) expected size.
  • Points drawn according to a two-dimensional normal distribution. The convex hull has Θ(

lg n) expected size.

(a) Given two convex polygons with n 1 and n 2 vertices respectively, show how to compute the convex hull of all n 1 + n 2 points in O(n 1 + n 2 ) time. (The polygons may overlap.) (b) Show that the convex hull of a set of n points drawn independently according to a sparse- hulled distribution can be computed in O(n) expected time. (Hint: Recursively find the convex hulls of the first n/2 points and the second n/2 points, and then combine the results.)

  1. (15 points – 5 points each part)

(a) Similar to part (a) of the previous problem, given k convex polygons, not necessarily disjoint, with overall n vertices, show how to compute their convex hull in O(kh + n) time, where h is the number of vertices in the convex hull. (b) Given a n points on the plane, show how to compute their convex hull in O(n log g) time, assuming you know a priori the number g of vertices on the convex hull. (c) Assume you have a solution to part(b). We can combine that with superexponential search to get another convex hull algorithm. Let g = 2^2 0 , 22 1 , 22 2 ,.. ., in turn. Run the algorithm from part (b), but for at most cn log g steps. (c is a constant which is large enough for the algorithm to terminate when g ≥ h. Its value and how to find such a c are not our present concern.) If a convex hull was found, return it, otherwise proceed with the next larger value of g. This algorithm is correct, since a large enough g guarantees success. What is its asymp- totic running time?