Skip to content

Instantly share code, notes, and snippets.

@EugenyB
Created November 26, 2014 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EugenyB/4e61bcf0434b85235137 to your computer and use it in GitHub Desktop.
Save EugenyB/4e61bcf0434b85235137 to your computer and use it in GitHub Desktop.
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