Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

a)

Code Block
function list = listSort(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

...