A C implementation of the Selection Sort which finds the lowest value
in the remaining data set is given above.
void selectionsort(int *array, int size) {
int i, j, lowindex;
for (i = 0; i < size - 1; i++) {
lowindex = i;
for (j = size - 1; j > i; j--)
if (array[j] < array[lowindex]) lowindex = j;
swapi (\&array[i], \&array[lowindex]);
}
}
|