Lua_冒泡排序

小鸟游星野
小鸟游星野
发布于 2025-03-15 / 14 阅读
0
0

Lua_冒泡排序

function sort(...)
a = {...}
b = nil

for j=1,#a-1 do
	for i=1,#a-j do
	if(a[i]>a[i+1]) then
		b = a[i+1]
		a[i+1] = a[i]
		a[i] = b
	end
end
end

return a


end


评论