Update InsertionSort.c

This commit is contained in:
Sudeepam 2017-10-18 02:05:57 +05:30 committed by GitHub
parent ea50acb609
commit 41f0292531

View File

@ -21,13 +21,13 @@ int main()
{ {
// You'll enter the loop if the elmtToInsert is less than the element just before it. // You'll enter the loop if the elmtToInsert is less than the element just before it.
arraySort[j+1] = arraySort[j]; /*shift the current element one place forward to create room for insertion of the arraySort[j+1] = arraySort[j]; //shift the current element one place forward to create room for insertion of the elmtToInsert
elmtToInsert when the correct position is found */
j--; j--;
} }
//when we exit the loop, j+1 will be the index of the correct position of the elmtToInsert //when we exit the loop, j+1 will be the index of the correct position of the elmtToInsert
arraySort[j+1] = elmtToInsert ; //'insert' the elmtToInsert into its correct position arraySort[j+1] = elmtToInsert ; //'insert' the elmtToInsert into its correct position
} }