|
Universidad de Costa Rica
|
|
|
|
InsertionSort()
(1) A[0].key := -¥;
(2) for i := 2 to n do begin
(3) j := i;
(4) while A[j] < A[j-1] do begin
(5) swap(A[j], A[j-1]);
(6) j := j-1
end
end
|