m01csc sorts a set of
data objects of arbitrary type, which are stored in the elements of an array at intervals of length
stride. The function may be used to sort a column of a two-dimensional array. Either ascending or descending sort order may be specified.
m01csc is based on Singleton's implementation of the ‘median-of-three’ Quicksort algorithm,
Singleton (1969), but with two additional modifications. First, small subfiles are sorted by an insertion sort on a separate final pass,
Sedgewick (1978). Second, if a subfile is partitioned into two very unbalanced subfiles, the larger of them is flagged for special treatment: before it is partitioned, its end-points are swapped with two random points within it; this makes the worst case behaviour extremely unlikely.
Singleton R C (1969) An efficient algorithm for sorting with minimal storage: Algorithm 347 Comm. ACM 12 185–187
- NE_2_INT_ARG_LT
-
On entry, while . These arguments must satisfy .
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_BAD_PARAM
-
On entry, argument
order had an illegal value.
- NE_INT_ARG_GT
-
On entry, .
Constraint: , an implementation-dependent size that is printed in the error message.
On entry, .
Constraint: , an implementation-dependent size that is printed in the error message.
On entry, .
Constraint: , an implementation-dependent size that is printed in the error message.
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
The example program reads a two-dimensional array of numbers and sorts the second column into ascending order.