Convex hull

Computing the convex hull in Computational Geometry is what Sorting in many problems - it is perhaps the most basic, elementary function on a set of points.

Definitions
A Convex Hull is the smallest convex polygon that contains every point of the set S. A polygon P is convex if and only if, for any two points A and B inside the polygon, the line segment AB is inside P.

One way to visualize a convex hull is to put a "rubber band" around all the points, and let it wrap as tight as it can. The resultant polygon is a convex hull.

Algorithms and Complexities
There are as many convex hull algorithms as Sorting algorithms. Any convex hull algorithm have the lower bound of $$\theta(n \log n)$$ through a reduction from Sorting, but it gives rises to Output Sensitive Algorithms, where the Complexity of the algorithm depends on the size of the output.

There are also other algorithms for special cases. Melkman's Convex Hull algorithm computes the convex hull of a simple polygonal chain (or a simple polygon) in linear time. Note that since h is at most n, the worst-case scenario for the $$O(nh)$$ algorithms is $$O(n^2)$$, and $$O(n \log n )$$ for the $$O(n \log h)$$ algorithms.
 * n is the number of points
 * h is the number of points in CH(S)