Consider a set of points in (set of real numbers in dimensional space). The closest pair problem is to find in a pair whose distance is the minimum, i.e., find and , such that for all point , where denotes the Euclidean distance between and . The brute-force method takes time by computing all inter-point distances and taking the minimum; the pair that gives the minimum distance is the closest pair. Here, the multiplier is due to dimension .
As is well-known, in one dimension, one can solve the problem much more efficiently: since the closest pair of points must occur consecutively on the real line, one can sort these points and then scan them in order to solve the closest pair problem in time. The time complexity turns out to be the best possible, since the problem has a lower bound of , following from a linear time transformation from the element uniqueness problem.
But unfortunately there is no total ordering for points in for , hence, sorting is not applicable. We will show that by using divide-and-conquer approach, one can solve this problem in optimal time. Let us consider the case when . In the following, we only compute the minimum distance between the closest pair; the actual identity of the closest pair that realizes the minimum distance can be found easily by some straightforward book-keeping operations. Consider a vertical separating line that divides into and such that . Let denote the minimum distance defined by the closest pair of points in , . Observe that the minimum distance defined by the closest pair of points in is either , or for some and . In the former cases, we are done. In the latter, points and must lie in the vertical strip of width on each side of the separating line (see figure ).
The problem now reduces to that of finding the closest pair between points in and that lie inside the strip of width . This subset of points possesses a special property, known as sparsity, i.e., for each square box (a hypercube of higher dimensions) of length the number of points in is bounded by a constant , since in each set , there exists no point that lies in the interior of the -ball centered at each point in , .
|