Jump to content

Sorting algorithms/Comb sort: Difference between revisions

Line 863:
gap := int_of_float (float !gap /. 1.3);
 
let i = ref 0 in
swapped := false;
whilefor (!i += !gap0 <to input_length) - !gap do
if input.(!i) > input.(!i + !gap) then begin
let tmp = input.(!i) in
input.(!i) <- input.(!i + !gap);
input.(!i + !gap) <- tmp;
swapped := true;
end;
incr i;
done
done
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.