Anonymous user
Sorting algorithms/Comb sort: Difference between revisions
m
→{{header|PL/I}}
Line 225:
declare swaps bit (1) aligned;
gap = hbound(A,1) - lbound(A,1); /* initialize the gap size. */
do until (gap <= 1 & swaps);
/* update the gap value for a next comb. */
gap = gap / 1.25e0;
put skip data (gap);
swaps = '1'b;
/* a single "comb" over the array. */
do i =
if A(i) > A(i+gap) then
do;
t = A(i); A(i) = A(i+gap); A(i+gap) = t;
swaps
end;
end;
|