M01CCF rearranges a vector of character data so that a specified substring is in ASCII or reverse ASCII order.
M01CCF is based on Singleton's implementation of the ‘median-of-three’ Quicksort algorithm (see
Singleton (1969)), but with two additional modifications. First, small subfiles are sorted by an insertion sort on a separate final pass (see
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.
Only the substring (
L1:
L2) of each element of the array
CH is used to determine the sorted order, but the entire elements are rearranged into sorted order.
Singleton R C (1969) An efficient algorithm for sorting with minimal storage: Algorithm 347 Comm. ACM 12 185–187
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${-{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Not applicable.
M01CCF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The routine relies on the Fortran intrinsic functions LLT and LGT to order characters according to the ASCII collating sequence.