A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

求大神帮忙分析分析

1 个回复

倒序浏览
public class bubbleSort {
public        bubbleSort(){
         int a[]={49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,54,56,17,18,23,34,15,35,25,53,51};
        int temp=0;
        for(int i=0;i<a.length-1;i++){
                for(int j=0;j<a.length-1-i;j++){
                if(a[j]>a[j+1]){
                        temp=a[j];
                        a[j]=a[j+1];
                        a[j+1]=temp;
                }
                }
        }
        for(int i=0;i<a.length;i++)
                System.out.println(a[i]);       
}
}
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马