for j = 2 to A.length
key = a[j]
i = j - 1
while i > 0 && a[i] > key
a[i + 1] = a[ i ]
i = i - 1
a[ i + 1] = key