...
Code Block |
---|
function sortedList = insertionSort(list)
len = length(list);
sortedList = zeros(1,len);
while len > 0
temp = -Inf;
for i = 1:len
if list(i) > temp
temp = list(i);
tempI = i;
end
end
sortedList(len) = list(tempI);
len = len-1;
list(tempI) = [];
end
end |
c)
Code Block |
---|
function mat = untitledFunction7(mat)
[l,~] = size(mat);
for i =1: l
mat(i,:) = insertionSort(mat(i,:));
end
end |