An Efficient k Nearest Neighbor Searching Algorithm for a Query Line

In this paper, we present an algorithm for finding k nearest neighbors of a given query line among a set of points distributed arbitrarily on a two dimensional plane. Our algorithm requires O(n 2) time and space to preprocess the given set of points, and it answers the query for a given line in O(k+logn) time, where k may also be an input at the query time. Almost a similar technique is applicable for finding the k farthest neighbors of a query line, keeping the time and space complexities invariant. We also discuss some constrained version of the problems where the preprocessing time and space complexities can be reduced keeping the query times unchanged.