QUICKSORT Subroutine

Purpose

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

Syntax

QUICKSORT( x)

Parameter

x
A one-dimensional array of scalars that must be one of the following:
  • Computational and not COMPLEX
  • POINTERs
  • HANDLEs
  • ORDINALs

If x is a BIT array, it must be BIT ALIGNED.

Description

The QUICKSORT built-in subroutine performs a quick-sort, overwriting x with the sorted elements. Sorted array elements are stored in increasing order in accordance with the result of a simple compare. If the result of the compare on two elements is equal, their order in the sorted array is unspecified.

Example

The following:

dcl arr (5) fixed bin (31) init (5,4,3,2,1);
call quicksort(arr);
put skip list (arr);

Prints:

1 2 3 4 5