INSERTION-SORT(A)- 1
for i ← 1 to n − 1 do - 2
key ← A[i] - 3
j ← i − 1 - 4
while j ≥ 0 and A[j] > key do ▷ > and not ≥ keeps the sort stable - 5
A[j + 1] ← A[j] - 6
j ← j − 1 - 7
A[j + 1] ← key
INSERTION-SORT(A)for i ← 1 to n − 1 dokey ← A[i]j ← i − 1while j ≥ 0 and A[j] > key do ▷ > and not ≥ keeps the sort stableA[j + 1] ← A[j]j ← j − 1A[j + 1] ← key