70
·
...until you
reach the
location for the
new element.
[0]
[1]
[2]
[3]
[4]
[5]
Insertion Sort
Finally, this is the correct location for the new element. In general there are two situations that indicate the "correct location" has been found:
1. We reach the front of the array (as happened here), or
2. We reached an element that is less than or equal to the new element.