int BSearch(int[] x, int n, int t) { int l = -1, u = n, p = 0, m = 0; while (l + 1 != u) { m = (l + u) /2; if (x[m] < t) { l = m; } else { u = m; } } p = u; if (p >= n || x[p] != t) { p = -1; } return p;}