sorting arrays
GENERIC INTERFACE ArraySort(Elem);
PROCEDURE Sort(VAR a: ARRAY OF Elem.T; cmp := Elem.Compare);
Sort the elements of a using the order defined by cmp.
END ArraySort.
Sort(a, cmp) permutes the elements of a such that:
FIRST(a) <= i < j <= LAST(a)
implies
cmp(a[i], a[j]) <= 0.
The algorithm used is QuickSort:
For an expanded description of QuickSort, see [Sedgewick:Alg] .
Where Elem.T is a type that is not an open array type and Elem contains
Compare must define a total order. Any parameter mode may be used.