<Li> Suppose there exists a function called Insert designed to insert a value into a sorted sequence at the beginning of an array . It operates by beginning at the end of the sequence and shifting each element one place to the right until a suitable position is found for the new element . The function has the side effect of overwriting the value stored immediately after the sorted sequence in the array . </Li> <Li> To perform an insertion sort, begin at the left-most element of the array and invoke Insert to insert each element encountered into its correct position . The ordered sequence into which the element is inserted is stored at the beginning of the array in the set of indices already examined . Each insertion overwrites a single value: the value being inserted . </Li> <P> Pseudocode of the complete algorithm follows, where the arrays are zero - based: </P> <P> The outer loop runs over all the elements except the first one, because the single - element prefix A (0: 1) is trivially sorted, so the invariant that the first i + 1 entries are sorted is true from the start . The inner loop moves element A (i) to its correct place so that after the loop, the first i + 2 elements are sorted . Note that the and - operator in the test must use short - circuit evaluation, otherwise the test might get stuck with an array bounds error, when j = 0 and it tries to evaluate A (j - 1)> A (j) (i.e. accessing A (- 1) fails). </P>

What is the big-o complexity of an insertion sort