The Selection Sort II Page

The Selection Sort operates by finding the subscript of the largest element in an array, i.e., the one which should be in the last position in the array. This element is then swapped with the one in the last position. Then the operation is repeated for the remaining elements, performing a swap to get the next highest element into position. This is repeated until all elements are properly sorted.

The Source

The Variables

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   NEXT  

The Output

The Source: The array is passed as a variable parameter (since it is likely to be altered) and the number of elements is passed as a value parameter. i is about to be set to the largest subscript used in the array.


Back to Main Page
© 2002 DFStermole
Created 5 Mar 2002
Last Modified 7 Mar 2002