- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑
Description:
This
routine returns the value of the Kth smallest element in the given array. It is an
implementation of an algorithm of Niklaus Wirth from the book "
Algorithms
data
structures = programs"
.
Invocation
CALL CCG_KTHx( EL, K, ARRAY, ANCDAT, VALUE, STATUS )
Arguments
EL = INTEGER (Given)
The number of elements in the input array.
K = INTEGER
(Given and Returned)
On entry the ordered value to be returned, on exit index of ARRAY that
contain the Kth smallest value.
ARRAY( EL ) = ? (Given and Returned)
The array of values
to be processed. Note this is modified on exit.
ANCDAT( EL ) = INTEGER (Given and
Returned)
Array of data whose association with ARRAY is to be preserved (such as a list
of pointers to the original positions within ARRAY).
VALUE = ? (Returned)
The Kth
smallest value in the input array.
STATUS = INTEGER (Given)
The global status.
Notes:
-
There is a routine for each numeric data type: replace "
x"
in the routine name by D, R, I, W, UW, B or
UB as appropriate. The ARRAY and VALUE arguments supplied to the routine must have the data
type specified.
- ←Prev
- KAPLIBS – Internal subroutines used within the KAPPA package.
- Next→
- TOC ↑