Convex Hull

← Back to Gallery
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

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