完成多个排序程序(不同算法)。
public class java7 {
public static void main(String[] args) {
int [] shuzhuA = {32,23,48,36,28,93,74};
/*for (int a = 0;a < shuzhuA.length;a++) { // 外层循环,
for (int b = 1;b < shuzhuA.length;b++) { // 内层循环,
int num = 0; // 设置一个存储值
if (shuzhuA [b-1] > shuzhuA [b]) { // 当满足if条件时,执行,交换两个数的值
num = shuzhuA [b-1];
shuzhuA [b-1] = shuzhuA [b];
shuzhuA [b] = num;
}
}
}*/
/*for(int i = 0;i < shuzhuA.length;i++){
int n = i;
for(int j = i + 1;j < shuzhuA.length;j++){
if(shuzhuA[n] > shuzhuA[j]){
n = j;
}
}
if (n != i ){
int num = shuzhuA[n];
shuzhuA[n] = shuzhuA[i];
shuzhuA[i] = num;
}
}*/
// Arrays.sort(shuzhuA); // 默认升序排列
for (int c = 0;c < shuzhuA.length;c++) {
System.out.println(shuzhuA [c]);
}
}
}