Abstract

Given a set of n elements, and a sorted sequence K = k 1 , k 2 , … , k r of positive integers between 1 and n , it is required to find the k i th smallest element for all values of i , 1 ≤ i ≤ r . We present a dynamic programming algorithm for computing an optimal permutation of the input ranks that results in the least number of comparisons when used as a preprocessing step with any algorithm that uses repetitive calls to an algorithm for selection. The running time of the proposed algorithm is O ( r 3 ) .

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call