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


Questions on HW4.
A detailed example of Graham scan; review of method.
Lower bound proof: Omega(n log n) from sorting. (Section 3.6) We showed that you can use a convex hull algorithm to sort n numbers, therefore showing that one cannot hope to do better than O(n log n). (Previously, I gave the argument for why Omega(n log n) holds for sorting.)
Divide and conquer algorithm: O(n log n). (Section 3.8) We discussed the method and showed how to merge in O(n) time using the "wobbling stick" to find the common tangents of two disjoint hulls. One can test in time O(1) if a point v is a left tangent point with respect to a point u. (Just do a couple cross products.)
Discussion of incremental insertion algorithm, which also gives O(n log n) worst-case algorithm (using O(log n) binary search to decide if a new point is inside the current hull or not, and then O(log n) binary search to find the two points of tangency, if the new point is outside the current hull). (Section 3.7) (Note that a much simpler RANDOMIZED algorithm yields an EXPECTED running time O(n log n).)
The "ultimate convex hull algorithm" takes O(n log h) time (first shown by Kirkpatrick and Seidel, then drastically simplified by Timothy Chan), and there is a known lower bound of Omega(n log h), showing that this is the best you can do if the time bound is written both in terms of n and h. I only mentioned that this exists (the algorithm is covered in the graduate course). You are expected to know that it is possible, and this is the best bound achievable in terms of n and h.
Melkman's convex hull algorithm: It computes in linear time (O(n)) the convex hull of a polygonal chain that is SIMPLE (not self-intersecting). (Equivalently, it computes the convex hull of a set of points that are given in an order such that linking the points in that order yields a noncrossing polygonal chain.) The main point is that SIMPLICITY HELPS: instead of worst-case O(n log n) or O(n log h), we can get O(n) if we know the points are the vertices of a simple chain.
Detailed example and review next time.