Skip to content

Instantly share code, notes, and snippets.

@djg
Created May 20, 2010 07:05
Show Gist options
  • Save djg/407290 to your computer and use it in GitHub Desktop.
Save djg/407290 to your computer and use it in GitHub Desktop.
void sort2(int* A, int n)
{
for (int i = 0; i < n; ++i)
{
int min = i;
for (int j = i+1; j < n; ++j)
{
if (A[j] < A[min])
min = j;
}
int tmp = A[i];
A[i] = A[min];
A[min] = tmp;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment