Convex Hull Algorithms
A visual exploration of computational geometry. How do different algorithms think about the exact same set of points? Watch them visually construct the optimal outer boundary.
Time & Space Complexity
| Algorithm | Time Complexity | Space Complexity |
|---|---|---|
| Brute Force | ||
| Jarvis March (Gift Wrapping) | ||
| Monotone Chain | ||
| Graham Scan | ||
| QuickHull | ||
| Divide & Conquer | ||
| Kirkpatrick-Seidel | ||
| Chan's Algorithm |
Brute Force
The absolute baseline. It checks every possible line segment against every other point. An incredibly inefficient but highly educational visualization.
Jarvis March (Gift Wrapping)
An output-sensitive algorithm. It sweeps a laser to find the widest right-turn, effectively "wrapping" a string around the outside of the points. Very fast if the hull has few points (small h).
Monotone Chain
The undisputed king of Competitive Programming. It sorts points by X-coordinate, then builds the lower and upper bounds left-to-right. Extremely robust because it completely avoids complex floating-point polar angles.
Graham Scan
The classic algorithm. It finds the lowest point, sorts all other points by their polar angle (like a sweeping radar), and maintains a stack to prune concave turns.
QuickHull
Similar to QuickSort. It draws a baseline, finds the furthest point to form a triangle, and ruthlessly deletes all points trapped inside. Extremely fast in practice.
Divide & Conquer
"Conquest before Marriage". It divides the points into tiny sub-hulls, solves them, and then uses walking tangent threads to perfectly stitch them together.
Kirkpatrick-Seidel
"Marriage before Conquest". It mathematically predicts the bridging upper tangent before recursing, allowing it to instantly delete massive chunks of points trapped underneath.
Chan's Algorithm
The Holy Grail. The absolute theoretical limit of 2D geometry. It duct-tapes Graham Scan and Jarvis March together, guessing the hull size and dynamically resizing until it snaps perfectly into place.