Java学习第七章.pptVIP

  • 7
  • 0
  • 约 111页
  • 2017-07-30 发布于河南
  • 举报
Java学习第七章

* From Idea to Soluton /** Use binary search to find the key in the list */ public static int binarySearch(int[] list, int key) { int low = 0; int high = list.length - 1; ? while (high = low) { int mid = (low + high) / 2; if (key list[mid]) high = mid - 1; else if (key == list[mid]) return mid; else low = mid + 1; } ? return -1 - low; } * The Arrays.binarySearch Method Since binary search is frequently used in programming, Java provides several overloaded binarySearch methods for searching a key in an array of int, double, char, short, long, and flo

文档评论(0)

1亿VIP精品文档

相关文档