%N sorti %F $MIR/src/subs/sort.for
%D Sort an integer array.
%P rjs
%: sorting
%B
        subroutine sorti(array,n)

        implicit none
        integer n,array(n)

  The main quick sort routine. Routine SPLIT does the choosing of
  the pivot, and the partitioning around it. Routine INSERT does
  a bubble sort variant when the number of elements to be sorted is
  less than 8.

  NOTE: The stack arrays START and END limit the sort to 2**nmax
        items.

  Input:
    n          Number of elements to be sorted.

  Input/Output:
    array      Input: Elements to be sorted.
               Output: Sorted elements.
