Skip to main content

ArgInsertionSort

This routine performs an indirect insertion sort on an array.

It returns the integer array which can be used for obtaining the sorted array.

Calling example:

CALL ArgInsertionSort(array, arg, low, high)

Then, array(arg) will be sorted in increasing order.

Interface

 MODULE PURE SUBROUTINE ArgInsertionSort(array, arg, low, high)
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), INTENT(IN) :: array(:)
INTEGER(I4B), INTENT(INOUT) :: arg(:)
INTEGER(I4B), INTENT(IN) :: low
INTEGER(I4B), INTENT(IN) :: high
END SUBROUTINE ArgInsertionSort
  • Here, entries of array are NOT modified by the routine.
  • arg should be allocated by the user
  • array(arg) returns the sorted array.