function c=bubble_sort(a)
% 冒泡算法
% Written by Phillip Wan @ 2013.9.11
% Email:[email protected]
for j=1:length(a)-1
for i=1:length(a)-1
if a(i)>a(i+1)
test=a(i);
a(i)=a(i+1);
a(i+1)=test;
end
end
end
c=a;
function c=bubble_sort(a)
% 冒泡算法
% Written by Phillip Wan @ 2013.9.11
% Email:[email protected]
for j=1:length(a)-1
for i=1:length(a)-1
if a(i)>a(i+1)
test=a(i);
a(i)=a(i+1);
a(i+1)=test;
end
end
end
c=a;