var res = [10,7,8,9,2,5,4,6,15,13,17,12]
for(var i = 0 ; i < res.length -1; i ++){
for(var j = 0 ; j <res.length-1 -i ; j ++){
if(res[j] > res[j +1]){
var tab = res[j]
res[j] = res[j+1]
res[j+1] = tab
}
}
}
console.log(res)
什么是冒泡排序
最新推荐文章于 2023-06-02 13:27:15 发布