L12 - Convex Hull: Grahams Scan Flashcards
What is the worst case time complexity of Jarvis March?
O(N^2)
Define the geometric property of Convex Hull that Grahams Scan is built on…
Convex hull can be traversed via making CCW turns
What is the task specification for Grahams Scan? (Problem, input, output, input-output relation)
Problem: Find the convex hull of S points
Input: is a set of points in multi-dimensional space
Output: is a list of H convex hull points in CCW ordering.
Input-output relation: H is the smallest convex set in S.
What was the motivation for Grahams Scan? When was it developed?
Grahams Scan was developed in 1972. The motive was to improve on the worst case time complexity of other convex hull algorithms such as Jarvis March. For example, Bell Labs were establishing hull for 10k points, and found the execution to be too slow.
Explain the step by step process of the algorithm…
Start from the left most point, find next point with smallest polar angle, if the previous, current, and next point create a CCW turn, discard the current point from the stack.
How are the points sorted?
Points are sorted via Polar angle
What is the most computationally expensive step of the algorithm?
Sorting via polar angle is the most expensive step -> O(n log n)
What is the worst case time complexity? Give proof…
Sort by polar angle + stack operations -> O(n log n) + O(n) = O( n log n )
What is the polar angle of a point?
Polar angle is the CCW angle of a point from the X axis
What is the improvement that Grahams Scan makes to Jarvis March?
Interior elimination, which ignores points known to not be on the convex hull.
Give 3 applications of Convex Hull…
Robotics pathfinding, Classification (if hulls don’t overlap).