Two applications of a probabilistic search technique: Sorting X+Y and building balanced search trees

  • Authors:
  • Michael L. Fredman

  • Affiliations:
  • -

  • Venue:
  • STOC '75 Proceedings of seventh annual ACM symposium on Theory of computing
  • Year:
  • 1975

Quantified Score

Hi-index 0.00

Visualization

Abstract

Let X &equil; {x1,...,xN} and Y &equil; {y1,...,yN} be sets of N real numbers. We denote by X + Y the multiset {xi + yj; 1 ≤ i, j ≤ N} of size N2. Berklekamp has posed the problem of sorting X + Y. Harper, Payne, Savage and Strauss [1] show that N21og2N comparisons suffice to sort X + Y, thereby saving a factor of 2 over sorting without exploiting the structure of X + Y. (Given u in X + Y, we assume that we know the i,j indices such that u &equil; xi + yj.) Furthermore, they show that this bound is tight for a restricted class of comparison algorithms. However, without their restriction the order of magnitude comparison complexity of this problem has remained an open question. In this paper we show that X + Y can be sorted with O(N2) comparisons. Our proof is unusual for this type of problem in that we do not explicitly exhibit an algorithm. Instead, it is a particular application of a more general search technique whose behavior is easily related to information theoretic lower bounds. In the context of sorting, this search method translates into an insertion sort, where the insertions are not performed by means of the usual binary search, but rather as off-centered searches designed so that each comparison, roughly speaking, equally divides the space of remaining possibilities. We draw attention to this search technique because it might find application to other problems, and we illustrate this possibility with a second application. Our second application concerns the construction of probabilistically balanced binary search trees.