function c=bubble_sort(a)
% 冒泡算法
% Written by Phillip Wan @ 2013.9.11
% Email:hackerwanhappy@foxmail.com
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;
冒泡算法排序数组
最新推荐文章于 2023-11-13 22:38:25 发布