Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int iter(int tab[], int x, int left, int right) {
- while (left <= right) {
- int mid = (left + right)/2;
- if (tab[mid] == x) return mid;
- if (x < tab[mid])
- right = mid - 1;
- else
- left = mid + 1;
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement