Why it matters
Convex hull is foundational computational geometry. Understanding enables geometric problems.
Advertisement
The architecture
Graham scan: sort by angle from lowest point; add points; pop when turn wrong direction.
Andrew's monotone chain: sort by x; construct upper + lower hulls.
Advertisement
How it works end to end
Cross product: (b-a) × (c-b). Sign indicates turn direction.
Complexity: O(n log n) for sort-based; O(nh) for gift wrapping (h = hull size).
3D + higher: much harder; use library.