Visually Explained Algorithms The insertion sort starts with the value at index 1 and compares it to the value at index 0. If the value at index 1 is less than the value at index 0, the values are swapped. The index is incremented, and the procedure is repeated. The best way to see this is with an example. We’ll start off with the following array. The algorithm starts at index position 1. The first comparison is executed. The insertion sort algorithm starts at index 1 and compares it to the index before, which in this case is index 0.