• Multidimensional data structures;
  • selection;
  • K-dimensional search trees;
  • partial match;
  • probabilistic analysis of algorithms


In this work we show how to augment general purpose multidimensional data structures, such as K-d trees, to efficiently support search by rank (that is, to locate the i-th smallest element along the j-th coordinate, for given i and j) and to find the rank of a given item along a given coordinate. To do so, we introduce two simple, practical and very flexible algorithms – Select-by-Rank and Find-Rank – with very little overhead. Both algorithms can be easily implemented and adapted to several spatial indexes, although their analysis is far from trivial. We are able to show that for random K-d trees of size n the expected number of nodes visited by Find-Rank is inline image for inline image or inline image, and inline image for inline image (with inline image), where inline image depends on the dimension K and the variant of K-d tree under consideration. We also show that Select-by-Rank visits inline image nodes on average, where inline image is the given rank and the exponent α is as above. We give the explicit form of the functions inline image and inline image, both are bounded in [0, 1] and they depend on K, on the variant of K-d tree under consideration, and, eventually, on the specific coordinate j for which we execute our algorithms. As a byproduct of the analysis of our algorithms, but no less important, we give the average-case analysis of a partial match search in random K-d trees when the query is not random. © 2012 Wiley Periodicals, Inc. Random Struct. Alg., 45, 14–37, 2014