function y=bubblesort(x)
%冒泡法排序.
r=length(x);
for i=1:r-1
for j=i+1:r
if x(i)>x(j)
temp=x(i);
x(i)=x(j);
x(j)=temp;
end
end
end
y=x;
function y=insertionsort(x)
%插入法排序.
r=length(x);
for i=1:r
for j=1:r-1
if x(j)>x(j+1)
temp=x(j);
x(j)=x(j+1);
x(j+1)=temp;
end
end
end
y=x;