Instantly share code, notes, and snippets.

Embed
What would you like to do?
void chooseSort(int a[], int size) {
for (int i=0; i<size-1; i++) {
int nMin = i;
int min = a[nMin];
for (int j=i+1; j<size; j++) {
if (a[j]<min) {
min = a[j];
nMin = j;
}
}
if (i != nMin) {
//int t = a[nMin];
a[nMin] = a[i];
a[i] = min;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment