Graham Scan
Jarvis March
Speed:
Points
0
Graham Steps
0
Jarvis Steps
0
🔷 Convex Hull
The convex hull of a set of points is the smallest convex polygon that contains all the points — like stretching a rubber band around pushpins.
How It Works
Graham Scan
Sort by polar angle from lowest point, then scan through points maintaining a left-turn-only stack.
O(n log n)
Jarvis March
Start from leftmost point, repeatedly find the point that makes the smallest counter-clockwise angle.
O(nh)
Instructions
- Click on either canvas to add points (synced)
- Run Both to watch algorithms race
- Step to advance one step at a time
- Random generates 20 random points
Legend
Point
Graham active
Jarvis active
Final hull
Complexity
Graham: O(n log n) — dominated by sorting.
Jarvis: O(nh) — where h is hull size. Faster when h is small.
Applications
- Collision detection in games
- Image processing (shape analysis)
- Geographic information systems
- Pattern recognition