Answers for "Shell-Sort Pascal"

0

Shell-Sort Pascal

Pascal
1  gap := X;
2  repeat
3  ok := 1;
4  for i := 1 to N - gap do
5    if A[i] > A[i+gap] then
6      begin temp:=a[i];
7        A[i]:=A[i+gap];
8        A[i+gap] := temp;
9        ok := 0
10     end;
11 if gap div 2>1 then gap:=gap div 2 else gap:=1
12 until ok=1;
Posted by: Guest on August-23-2021

Browse Popular Code Answers by Language