Aim: Program to sort the given numbers using Insertion sort.
Algorithm:
insertionSort(array A)
begin
for i := 1 to length[A] - 1 do
begin
value := A[i];
j := i - 1;
while j >= 0 and A[j] > value do
begin
A[j + 1] := A[j];
j := j - 1;
end;
A[j + 1] := value;
end;
end;
Google Ads
Sunday, September 13, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment