// File: ssort.c // // Selection Sort Routines #include "array.h" #include "sorts.h" void SelectionSort(Array& A) { int high, i, j, min ; DATA temp ; high = A.length() - 1 ; for (i = 0 ; i < high ; i++) { // find index of ith smallest number min = i ; for (j = i+1 ; j <= high ; j++) { if (A[j] < A[min]) min = j ; } // swap the ith smallest number to the right place temp = A[min] ; A[min] = A[i] ; A[i] = temp ; } }