标签:.com code 图片 bubuko rip alt script http bsp
冒泡排序:
<script> var flag = false; var arr1 = [0,-90,89,36743,87,-89,9] for(var i=0;i<arr1.length-1;i++){ for(var j=0;j<arr1.length-1-i;j++){ if(arr1[j]>arr1[j+1]){ var temp = arr1[j]; arr1[j]=arr1[j+1] arr1[j+1]=temp; flag=true; } } if(flag){ flag=false; }else{ break; } } for(var i=0;i<arr1.length;i++){ document.write(arr1[i]+" ") } </script>
结果:
标签:.com code 图片 bubuko rip alt script http bsp
原文地址:https://www.cnblogs.com/alex-xxc/p/9979523.html