mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08: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