Insertion sort

Hide text Hide pseudo-code

Apply insertion sort to the Input table below.

Some additional problems.

InsertionSort(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 Wed Jun 20 16:00:42 EEST 2007 - Powered by SVG-hut