clear;clc;close all
x = [4,3,1,6,7,5,2,1,5,6,7,8];
n = length(x);
for i = 2 : n
for j = n : -1 : i
if x(j) < x(j-1)
x([j,j-1]) = x([j-1,j]);
end
end
end
冒泡排序MATLAB实现
于 2019-12-06 10:27:11 首次发布