You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

a)

function list = sortFunc(list)
sorted = 0;
len = length(list);
while sorted == 0
    sorted = 1;
    for i = 2:len
        if list(i) < list(i-1)
            temp = list(i);
            list(i) = list(i-1);
            list(i-1) = temp;
            sorted = 0;
        end
    end
    
end
end
  • No labels