Paper record
W1974618846Algorithm 410: Partial sorting
John M. Chambers
- Year
- 1971
- Venue
- Communications of the ACM
- References
- 3
- Cited by
- 39
Details and counts from OpenAlex.
Abstract
We introduce the notion of partial sorting as follows.Given an array A of" N elements the result of sorting the array (in place) is to arrange the elements of A so that A(1) < A(2) < .. -< A(N).An equivalent statement is that, for J = 1, 2, ... , N, A(J) is a value such that for 1 < I < J < K < N A(1) _< A(J) _< A(K)(1) This property is also equivalent to the statement that A(J) is the Jth order statistic [4] of A, for all J.Partial sorting is a procedure which rearranges A so that (1) holds for some selected values of J, but not necessarily for all J.The advantage of using partial sorting, where possible, is that the cost is substantially less than for sorting, when the number of order statistics required is small compared to N.Such will frequently be the case, for example, in statistical applications, when the sample is to be summarized using some of the order statistics.For large N only a portion of the sample would be needed, even for displays such as the empirical distribution function.Specifically, in the algorithm PSORT below, the user supplies the array A of size N and a set of indices IND of size NL On return, A will have been rearranged so that relation (l) holds, i.e.A(J) has the value it would have if A were sorted, for J = IND(I), IND(2), .... IND(NI).For example, suppose A is the vector (10., 8., 3., 5, 7., 2.) and IND is the vector (2, 5).Then after a partial sort of A with IND, A(2) = 3. and A(5) = 8..