随笔分类 -  算法

摘要:/** * 冒泡排序的核心就是,按顺序进行两两比较,如果第一个比第二个大则交换位置 */ public class MaoPaoPaiXu { private static int[] bubbleSort(int[] a) { // 至少进行n-1轮比较 for (int i = 0; i a[j + 1]) { ... 阅读全文
posted @ 2019-04-29 18:35 劈天造陆 阅读(177) 评论(0) 推荐(0)
摘要:public class BinarySearch { public static void main(String[] args) { int[] a = {1,2,3,4,5,6,7,8,9}; int binarySerach = binarySerach(a, 4); System.out.println(binarySe... 阅读全文
posted @ 2019-04-29 18:34 劈天造陆 阅读(244) 评论(0) 推荐(0)

点击右上角即可分享
微信分享提示