Declaration: TVector.SortElems (Ascending: boolean; RangeFirst, RangeLast: integer);
The method SortElems provides a means to sort the elements of a vector or part of it. The vector is sorted within the range RangeFirst and RangeLast. The values outside this range are not affected. If both RangeFirst and RangeLast are set to zero values the entire vector is sorted. The parameter Ascending specifies whether the valus are to be sorted in ascending (TRUE) or descending (FALSE) order.

The sorting is performed by a modified bubble sort (CombSort), which has been reported to be comparable in speed to QuickSort (see also R.Box, S. Lacey, BYTE magazine, April 1991).

Example: The statement V1.SortElems (true, 1, V1.NrOfElems) sorts the whole vector V1 in ascending order.