PDA_QSDx

Sort an array into descending order

Description:

The routine uses the QUICKSORT algorithm to sort an array of values into descending order. The “median of three” modification is included to reduce the likelihood of encountering the worst-case behaviour of QUICKSORT.

The routine exists for types REAL (x=R), DOUBLE PRECISION (x=D), and INTEGER (x=I).

Invocation

CALL PDA_QSDx( EL, X )

Arguments

EL = INTEGER (Given)
The number of elements of X to be sorted.
X( EL ) = TYPE (Given and Returned)
The array to be sorted.

References

Sedgwick, R., 1988, Algorithms (Addison-Wesley).

Timing

If N elements are to be sorted, the average time goes as N*ln(N). The worst-case time goes as N**2.

Copyright

Copyright (C) 1992 Science & Engineering Research Council