代码如下: public class HalfSearch { public static int halfSearch(int a[], int x) { int mid, left, right; left = 0; right = a.length - 1; mid = (left + right) / 2; while (a[mid] != x) { if (x a[mid]) { left = mid + 1; } else if (x a[mid]) { right = mid...
[ 查看全文 ]