摘要: 二分查找(折半查找) 前提:排好顺序的数据 //元素存在 返回索引,否则返回-1 public static int binarySearch(int[] arr, int data) { int left = 0; int right = arr.length - 1; while(left <= 阅读全文
posted @ 2022-11-01 10:20 都是废话说了 阅读(16) 评论(0) 推荐(0)