Analysis of Hoare's FIND algorithm with Median-of-three partition

Hoare’s FIND algorithm can be used to select the jth element out of a file of n elements. It bears a remarkable similarity to Quicksort; in each pass of the algorithm, a pivot element is used to split the file into two subfiles, and recursively the algorithm proceeds with the subfile that contains the sought element. As in Quicksort, different strategies for selecting the pivot are reasonable. In this paper, we consider the Median-ofthree version, where the pivot element is chosen as the median of a random sample of three elements. Establishing some hypergeometric differential equations, we find explicit formulae for both the average number of passes and comparisons. We compare these results with the corresponding ones for the basic partition strategy. Q 1997 John Wiley & Sons, Inc. Random Ž . Struct. Alg., 10, 143]156 1997