You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
optimized for loop & corrected comments (trekhleb#617)
The existing insertion sort implementation began by iterating from
0 until the end of the array, but it is only necessary to
iterate from 1 until the end of the array, since at the
0th index, there is nothing to compare to the left of
the element.
In order to complete this change, I also had to update the tests
to reflect the fact that the algorithm visits each index 1 less
time.
Finally, I corrected the grammar/wording of the comments.
Co-authored-by: Oleksii Trekhleb <[email protected]>
0 commit comments