Foundations‎ > ‎Algorithms‎ > ‎Sorting‎ > ‎

Insertion sort

- Time Complexity -

O(n2)

- Pseudocode -

INSERTION-SORT(A) 1 for j ← 2 to length[A] 2 do key ← A[j] 3 i ← j - 1 4 while i > 0 and A[i] > key 5 do A[i+ 1] ← A[i] 6 i ← i - 1 7 A[i+1] ← key