Skip to content

Instantly share code, notes, and snippets.

@EugenyB
Created November 26, 2014 21:25
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/df7743f29fbd7a83b3e5 to your computer and use it in GitHub Desktop.
Save EugenyB/df7743f29fbd7a83b3e5 to your computer and use it in GitHub Desktop.
void insertSort(int a[], int size) {
for (int i=1; i<size; i++) {
int t = a[i];
int j=i-1;
for (; j>=0; j--) {
if (a[j] > t) {
a[j+1] = a[j];
} else {
break;
}
}
a[j+1] = t;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment