Overview
Graham Scan sorts points around an anchor point and uses a stack to remove points that would make an inward turn.
Computes a convex hull by sorting points by angle and keeping valid turns.
Compact metadata for implementation and discovery.
Graham Scan sorts points around an anchor point and uses a stack to remove points that would make an inward turn.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n log n)
Average
O(n log n)
Worst
O(n log n)
Space
O(n)
pop while orientation(second_last, last, candidate) <= 0Removes points that would make the hull turn clockwise or become collinear, depending on the chosen boundary rule.
Show points being pushed and popped while the hull forms.
Graham Scan operates in O(n log n) time and O(n) space within the Convex Hull family. Key governing relation: pop while orientation(second_last, last, candidate) <= 0. Often compared with Convex Hull and Point in Polygon.
What each reference supports for this entry.
Computational geometry textbook reference for the predicates or constructions used by Graham Scan.
Good next jumps from the relationship graph, ranked for useful discovery.
Graham Scan is a specific convex hull algorithm based on sorting and orientation tests.
Both compute convex hulls with different output-sensitive behavior.