Sorting algorithms/Comb sort: Difference between revisions

→‎{{header|MATLAB}}: Optimized the swap
(Added a solution for MATLAB)
(→‎{{header|MATLAB}}: Optimized the swap)
Line 387:
if (list(i) > list(i+gap))
templist([i i+gap]) = list([i+gap i]); %swap
list(i) = list(i+gap);
list(i+gap) = temp;
swaps = true;
end
Anonymous user