<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> var arr=[95,2,8,6,30,2,3,7,4,7,4,93]; for (var i = 0; i < arr.length; i++) { arr[i] for (var j = arr.length; j>i; j--) { if (arr[j]>arr[j-1]) { var c; c=arr[j]; arr[j]=arr[j-1]; arr[j-1]=c; } } } document.write(arr+"<br />"); </script> </body> </html>
冒泡排序-从大到小
最新推荐文章于 2024-07-29 17:33:56 发布