The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information.... |
Home MathPack Math1 Sorting SortArray | |||||||||||||||||||
See also: SortIntoArray, InsertIntoArray, TVarKind, SortSwap, SortArray (OpenArrrays) | |||||||||||||||||||
SortArray |
|||||||||||||||||||
The procedure SortArray sorts a one-dimensional numeric array either in ascending or descending order. This routine uses a modified bubble sort ('CompSort') algorithm, which is superior to 'QuickSort' in many cases. SortArray is available in four overloaded versions. Version [1] is only available for the Win32 environment, but not for .NET. The parameter ArrayAdr holds a pointer to the array (use the operator '@'). The parameter LengArray defines the length of this array (i.e. the maximum number of elements of this array). The parameter LengArray may be defined smaller than the actual size of the array. In this case only the first LengArray elements are processed by SortArray. The parameter TypArray defines the type of the array elements. The users should be aware that a wrong designation of the type of the array elements leads to severe errors and can cause a system crash. The following types are valid: inum (integer), lnum (longint), snum (single), dnum (double), and rnum (real); the types strg (string) and bool (boolean) are not supported. As an alternative to version [1] you may use the simpler versions [2], [3], and [4] for integer, single, or double precision arrays, respectively. The parameter Ascending specifies whether the array should be sorted by ascending (TRUE) or descending (FALSE) values. SortArray increments the global variable ProcStat and calls the feedback routine MathFeedBackProc in order to allow feedback to the user during time consuming calculations.
|