mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-12-08 19:06:00 +00:00
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 <trehleb@gmail.com>