Adaptive sampling strategies for quickselects

  • Authors:
  • Conrado Martínez;Daniel Panario;Alfredo Viola

  • Affiliations:
  • Universitat Politècnica de Catalunya, Barcelona, Spain;Carleton University, Ottawa, Canada;Universidad de la República, Casilla de Correo, Uruguay

  • Venue:
  • ACM Transactions on Algorithms (TALG)
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Quickselect with median-of-3 is largely used in practice and its behavior is fairly well understood. However, the following natural adaptive variant, which we call proportion-from-3, had not been previously analyzed: “choose as pivot the smallest of the sample if the relative rank of the sought element is below 1/3, the largest if the relative rank is above 2/3, and the median if the relative rank is between 1/3 and 2/3.” We first analyze the average number of comparisons made when using proportion-from-2 and then for proportion-from-3. We also analyze ν-find, a generalization of proportion-from-3 with interval breakpoints at ν and 1-ν. We show that there exists an optimal value of ν and we also provide the range of values of ν where ν-find outperforms median-of-3. Then, we consider the average total cost of these strategies, which takes into account the cost of both comparisons and exchanges. Our results strongly suggest that a suitable implementation of ν-find could be the method of choice in a practical setting. We also study the behavior of proportion-from-s with s3 and in particular we show that proportion-from-s-like strategies are optimal when s→∞.