acm-header
Sign In

Communications of the ACM

Communications of the ACM

Algorithm 489: the algorithm SELECT—for finding the ith smallest of n elements [M1]


SELECT will rearrange the values of array segment X[L: R] so that X[K] (for some given K; LKR) will contain the (K-L+1)-th smallest value, LIK will imply X[I] ≤ X[K], and KIR will imply X[I] ≥ X[K. While SELECT is thus functionally equivalent to Hoare's algorithm FIND [1], it is significantly faster on the average due to the effective use of sampling to determine the element T about which to partition X. The average time over 25 trials required by SELECT and FIND to determine the median of n elements was found experimentally to be: n 500 1000 5000 10000 SELECT 89 ms. 141 ms. 493 ms. 877 ms. FIND 104 ms. 197 ms. 1029 ms. 1964 ms. The arbitrary constants 600, .5, and .5 appearing in the algorithm minimize execution time on the particular machine used. SELECT has been shown to run in time asymptotically proportional to N + min (I, N-I), where N = L - R + 1 and I = K - L + 1. A lower bound on the running time within 9 percent of this value has also been proved [2]. Sites [3] has proved SELECT terminates.

The full text of this article is premium content


 

No entries found

Log in to Read the Full Article

Sign In

Sign in using your ACM Web Account username and password to access premium content if you are an ACM member, Communications subscriber or Digital Library subscriber.

Need Access?

Please select one of the options below for access to premium content and features.

Create a Web Account

If you are already an ACM member, Communications subscriber, or Digital Library subscriber, please set up a web account to access premium content on this site.

Join the ACM

Become a member to take full advantage of ACM's outstanding computing information resources, networking opportunities, and other benefits.
  

Subscribe to Communications of the ACM Magazine

Get full access to 50+ years of CACM content and receive the print version of the magazine monthly.

Purchase the Article

Non-members can purchase this article or a copy of the magazine in which it appears.
Sign In for Full Access
» Forgot Password? » Create an ACM Web Account