Insertion sort

Hide text Hide pseudo-code
Apply insertion sort to the Input table below.
INSERTION-SORT(a)
1 for i = 1 to n-1 do
2   tmp = a[i]
3   j = i
4   while j > 0 AND a[j-1] > tmp do
5     a[j] = a[j-1]
6     j = j - 1
7   a[j] = tmp


  Created Fri Oct 30 13:52:49 EET 2009 - Powered by SVG-hut