AnO(n logn) algorithm for the all-nearest-neighbors Problem

Given a setV ofn points ink-dimensional space, and anLq-metric (Minkowski metric), the all-nearest-neighbors problem is defined as follows: for each pointp inV, find all those points inV−{p} that are closest top under the distance metricLq. We give anO(n logn) algorithm for the all-nearest-neighbors problem, for fixed dimensionk and fixed metricLq. Since there is an Θ(n logn) lower bound, in the algebraic decision-tree model of computation, on the time complexity of any algorithm that solves the all-nearest-neighbors problem (fork=1), the running time of our algorithm is optimal up to a constant factor.