Finding Convex Hull - Jarvis March
Algorithm
- Find the leftmost point. This is the starting hull point.
- Add current point to hull.
- Assume any other point as next point.
- Check every point:
- if it is more counterclockwise, update next point
- if collinear, keep the farthest one
- Move to next point and repeat.
- Stop when you return to starting point.
Time Complexity
- O(nh), where h is number of hull points
Space Complexity
- O(h)