Java 冒泡排序法
比较基础的算法,就是容易忘
public class 排序
{
public int a
[] = new int[10000];
@Test
public void test() {
int temp
;
int l
= 0;
for(int i
=9999;i
>0;i
--)
{
a
[l
] = i
;
l
++;
}
for(int i
= 0;i
<9999;i
++)
{
for(int j
= 0;j
<9999-i
;j
++)
{
if(a
[j
+1]<a
[j
])
{
temp
= a
[j
+1];
a
[j
+1] = a
[j
];
a
[j
] =temp
;
}
}
}
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-2914.html