mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 05:21:49 +03:00
Update InsertionSort.c
This commit is contained in:
parent
ea50acb609
commit
41f0292531
@ -21,13 +21,13 @@ int main()
|
||||
{
|
||||
// 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
|
||||
elmtToInsert when the correct position is found */
|
||||
arraySort[j+1] = arraySort[j]; //shift the current element one place forward to create room for insertion of the elmtToInsert
|
||||
j--;
|
||||
}
|
||||
//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
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user