proc insertion_sort( t is array[1..n] of int ) { for i in 2..n do var j = i while ((j > 0) and (t[ j ] < t[ j - 1 ])) do swap( t[ j - 1 ], t[ j ] ) j = j - 1 end while end for end proc