public static void selectSort(int [] A) {
int i,j, temp;
j = 0;
//invariant: A[0..j-1] is sorted
and for all k: 0 <= k < j
//and for all h: j <= h < A.length: A[k] <= A[h]
while (j < A.length) {
i = j + 1;
while (i < A.length) {
cmprs++; count++;
if (A[i] < A[j]) {
swaps++;
temp = A[i];
A[i] = A[j];
A[j] = temp;
}
i++;
}
j++;
count++;
}
count++;
} //end selectSort