经典排序与Arrays.sort() 比较

import java.util.Arrays ;

public class EbaseBubbleSort {

public static void main(String [] args) {

    int [] _a = new int [] { 4, 3, 656, 3254, 66, 77, 5 } ;

    baseSort(_a) ;//1.经典排序

// Arrays.sort(_a);//2.数组排序算法
System.out.println(Arrays.toString(_a)) ;

}

private static void baseSort(int [] _a) {

    int temp ;

    for (int i = 0; i < _a.length; i++) {

        for (int j = 0; j < _a.length - i - 1; j++) {

            if (_a[j + 1] < _a[j]) {
                temp = _a[j] ;
                _a[j] = _a[j + 1] ;
                _a[j + 1] = temp ;
            }

        }

    }

}

}

全部评论

相关推荐

程序员小白条:现在这个简历很没竞争力,而且很多都不要28届的,基本就看运气了,如果没简历包装的话,就海投中小厂吧
点赞 评论 收藏
分享
03-12 14:52
已编辑
长沙学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务