Definition · The divide-and-conquer closest pairSort the points by x. If there are at most three, compare all pairs. Otherwise split at the median into L and R, recurse on each, and let d be the smaller of the two distances returned — held throughout as d², which is an integer. Form the strip: the points whose x is within d of the dividing coordinate, tested as (x − mid)² < d² so that nothing is rooted, and sorted by y. For each strip point, compare it with the following strip points until the y gap alone reaches d, again tested as (Δy)² ≥ d². Return the smallest distance seen.
Theorem · The merge step is sufficientIf the closest pair has one point in L and one in R, then both lie within d of the dividing line, and in the strip sorted by y they are at most seven positions apart.
Let p ∈ L and q ∈ R be a pair at distance less than d. Then |px − qx| < d, and the dividing coordinate lies between px and qx, so each of them is within d of it. Both are therefore in the strip, and |py − qy| < d as well, so the scan's early exit on the y gap does not skip the pair.
For the position bound, consider the 2d-by-d rectangle centred on the dividing line and running from py to py + d. Every strip point between p and q in the y order lies in it. Cut the rectangle into eight squares of side d/2; the diagonal of such a square is d/√2 < d, so two points in one square would be closer than d, which contradicts d being the best distance within L and within R. Hence the rectangle holds at most eight points including p, so q is at most seven positions after it.
□
Read the second half of that proof carefully, because it is where the constant comes from and it is not an estimate. The eight squares are a packing argument: two points within one half-d square would violate the recursive guarantee, so there is at most one per square. The 7 is 8 − 1, and a different rectangle partition gives a slightly different constant — the literature has versions with 6 and with 4 — without changing the asymptotics at all.
Example · Twelve points, and where the answer was foundThe lab opens on twelve points running left to right, with (11, 4), (12, 5) and (13, 4) bunched together near the middle. The closest squared distance is 2, between (11, 4) and (12, 5) — and also between (12, 5) and (13, 4), so two pairs tie. The recursion made 17 comparisons; testing all 66 pairs gives the same answer. Five of those 17 were inside a strip, against a bound of 7n = 84.
It is worth being precise about where the winning pair was found, because the story about straddling pairs is easy to over-tell. Sorted by x, the top-level split is at x = 14 and the left half's split is at x = 11; (11, 4), (12, 5) and (13, 4) all land in the same three-point base case, and the pair is found by brute force there. The strip at the level above re-examines it and confirms it. So on this input the strip caught nothing the base cases had not already found — which is common, and is exactly why the strip cannot be dropped: nothing in the algorithm knows in advance that it was unnecessary here.
The measured column and the proved column
The lab's per-merge table gives, for each merge, the number of points, the size of the strip, and the comparisons made inside it. On the twelve points it reads: one merge with a strip of 2 making 1 comparison, one with a strip of 5 making 4, and the top-level merge with a strip of 2 making none. Total 5. The rightmost column is comparisons per strip point, as an exact fraction, and the largest is 4/5.
Beside it sits 7n = 84. Those two numbers are not the same kind of thing and the page labels them as such: 5 is a count of comparisons this run made, and 84 is a bound evaluated at n = 12. Their ratio is not a measure of anything, and in particular it is not a measure of how loose the proof is. The proof is about the worst input; this is one input.
What every pair costs, and when the recursion is worth it
17 comparisons against 66 is a real saving at n = 12 and it is a small one in absolute terms. The lab's five-point worked examples show the recursion doing 4 comparisons against 10, and its two-point example doing 1 against 1, where the recursion never happens at all. The crossover is where n log n falls below n(n − 1)/2, and at these sizes the constants matter more than the asymptotics.
The reason to build it anyway is the reason to build any of this: the bound is O(n log n) for every input, and the quadratic scan is Θ(n²) for every input. The lab runs both on the same points precisely because a recursion that drops a straddling pair returns a number that is real, plausible and too large, with no internal sign that anything went wrong.