# An*O*(*n* log*n*) algorithm for the all-nearest-neighbors Problem

Article

- First Online:

- Received:
- Revised:

DOI: 10.1007/BF02187718

- Cite this article as:
- Vaidya, P.M. Discrete Comput Geom (1989) 4: 101. doi:10.1007/BF02187718

## Abstract

Given a set*V* of*n* points in*k*-dimensional space, and an*L*_{q}-metric (Minkowski metric), the all-nearest-neighbors problem is defined as follows: for each point*p* in*V*, find all those points in*V*−{*p*} that are closest to*p* under the distance metric*L*_{q}. We give an*O*(*n* log*n*) algorithm for the all-nearest-neighbors problem, for fixed dimension*k* and fixed metric*L*_{q}. Since there is an Θ(*n* log*n*) lower bound, in the algebraic decision-tree model of computation, on the time complexity of any algorithm that solves the all-nearest-neighbors problem (for*k*=1), the running time of our algorithm is optimal up to a constant factor.

## Copyright information

© Springer-Verlag New York Inc. 1989