On the Variance of Quickselect

Quickselect with median-of-three is routinely used as the method of choice for selection of the mth element out of n in general-purpose libraries such as the C++ Standard Template Library. Its average behavior is fairly well understood and has been shown to outperform that of the standard variant, which chooses a random pivot on each stage. However, no results were previously known about the variance of the median-of-three variant, other than for the number of comparisons made when the rank m of the sought element is given by a uniform random variable. Here, we consider the variance of the number of comparisons made by quickselect with median-of-three and other quickselect variants when selecting the mth element for m/n → α as n → ∞. We also investigate the behavior of proportion-from-s sampling as s → ∞.