Handouts:
3/3/08: Convex hulls in 2D



SuperSlowCH: O(n^4) to identify vertices
SlowCH: O(n^3) to identify edges of CH(S).
Better CH: Jarvis March ("Gift Wrap"): output-sensitive O(nh), but worst-case O(n^2). Here, h is the output size (number of hull vertices. Discussion of the fact that E(h) = O(log n), if the n points are uniformly distributed in a square. (Here, E(h) is the expected value of the number, h, of hull vertices.)
QuickHull: This is a type of divide-and-conquer algorithm with worst-case time O(n^2). For uniformly distributed points, though, it is expected time O(n). It works well in practice and generalizes to higher dimensions.
Graham Scan: Describe in detail, with example. Graham scan algorithm: (1) angularly sort (in O(n log n)) about a hull vertex (rightmost among the bottommost), then (2) do Graham scan (in O(n) time, since each point is pushed or popped from the stack at most once). This gives a worst-case O(n log n) algorithm.
Analysis: The sorting step takes O(n log n), but all other phases are only O(n). The total time is therefore O(n log n). We will argue later that this is optimal (no algorithm can do better in the worst case than O(n log n) (except that we will see if the running time is written in terms of both the input size n AND the output size h, we can do O(n log h), and this is best possible in these terms).
See Convex hull algorithm applets.