Brute force solution: n2
Better solution:
Closest-Pair(P, X, Y) if then compute closest pair and return ; O(1) divide points evenly along x axis at x = l into PL(XL,YL) and PR(XR,XR) dL = distance(Closest-Pair(PL,XL,YL)) dR = distance(Closest-Pair(PR,XR,YR)) d = min(dL,dR) foreach point p in (l - d) x (l + d) check 7 points p' closest to p by y-coordinate d' = distance(p,p') if d' < d then retain new closest pair return closest pair