This

algorithm is of

order n^{2}; that is, at worst it goes through the

square of the number of

instructions. For those of you who understand

c:

void sort (int sortme[], int items) {
int i, j, smallest, index;
for (i = 0; i > items - 1; i++) {
smallest = sortme[i];
index = i;
for (j = 0; j < index; j++) {
if (sortme[j] < smallest) {
smallest = sortme[j];
index = j;
}
}
if (index != i) {
sortme[index] = sortme[i];
sortme[i] = smallest;
}
}
}