Given $N$ points in a plane, find the 2 points that are closest on the plane. $\ell_2$ norm
- Sort by $X$ and $Y$ coordinates
- Pivot problem into 2 parts along $X$-axis
- Recursively solve both parts
- Now have smallest distance on both sides, how to find if smallest distance is “cross border”?
- On one side, each distance is at least $\delta$. Note that creating a box of $\delta/2$, only one point necessarily is in the box
- On each side of the border will be a vertical sequence of border boxes, if there are 2 points on adjacent cross border boxes, there is a smaller cross border distance
- Hence, only need to check 10 boxes for each point on 1 side
 
$T(n)=2T(n/2) + \Theta(n)$ $=\mathcal{O}(n\log n)$
2 Dimensional gift wrapping: find convex wrap around odd shape (Convex hall)
Given $n$ points in $\R^2$, find convex polygon on the boundary
Assume all $x$ and $y$ coordinates are distinct
There are no 3 points on the same line
- Divide points by $x$ coordinate
- We now have two convex polygons on each side
- Create a line between the two polygons, find the highest tangent by rotating counterclockwise and clockwise
NP-Completeness
$P$ is the class of all problems solvable in polynomial time.
Take some verifier $V$ which is some polynomial-time machine.
$NP$ is the class of all problems that are easy to verify in polynomial time. (Using some verifier $V$)
Completeness: if $x\in L$, then $P$ has a $w$ that makes $V$ accept
Soundness: if $x \notin L$, $P$ has no way of convincing $V$ to accept