Created
August 13, 2016 03:45
-
-
Save educartoons/3aeb015bb8827dc09bad260ff23964d9 to your computer and use it in GitHub Desktop.
Method for Sorting known like Insertion Sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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