Skip to content

Instantly share code, notes, and snippets.

@educartoons
Created August 13, 2016 03:45
Show Gist options
  • Save educartoons/3aeb015bb8827dc09bad260ff23964d9 to your computer and use it in GitHub Desktop.
Save educartoons/3aeb015bb8827dc09bad260ff23964d9 to your computer and use it in GitHub Desktop.
Method for Sorting known like Insertion Sort
void insertionSort(int *array, int array_length){
int i, j, key;
for(j=1;j<array_length;j++){
key = array[j];
i=j-1;
while(i>=0 && array[i]>key){
array[i+1]=array[i];
i=i-1;
}
array[i+1]=key;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment