Scatter a handful of dots on a page and ask: which two are closest together? Your eye answers in an instant. Now scatter ten thousand dots â and suddenly the question is not so trivial.
The obvious recipe is to measure every pair. With n points there are about /2 pairs, so doubling the points roughly quadruples the work. For a million points that's half a trillion distance checks â too slow for the air-traffic radar, the chip-design tool, or the map app that needs the answer now.
The wonderful surprise is that you don't have to look at every pair. With a clever divide-and-conquer strategy the closest pair falls out in almost-linear time â a textbook example of how the right idea turns a hard-looking problem into an easy one.
Comments
Loading comments...