QUICKSORT

QUICKSORT performs a quick-sort of an array by using a simple compare.

Read syntax diagramSkip visual syntax diagramQUICKSORT( x, n, m)
x
An array expression. x must be a one-dimensional array of scalars. If x is an array of NONVARYING BIT, it must be aligned.
The elements of the array x must satisfy one of the following:
  • They must be computational and not COMPLEX
  • They must be POINTERs
  • They must be HANDLEs
  • They must be ORDINALs
n
An expression that specifies the index of the first array element to be examined. It defaults to LBOUND(x).
m
An expression that specifies the number of to-be-examined array elements. The counting starts with the nth and defaults to HBOUND(x) – n + 1.

The sorted array elements are stored in increasing order, in accordance with the result of a simple compare. If two elements are equal, their order in the sorted array is unspecified.

QUICKSORT overwrites the contents of x with the sorted elements. When the quick-sort is finished, for elements j and k:
  • if j < k, then x(j) < = x(k)