Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int binSrc(int v[], int p, int q, int x) {
- if (p > q)
- return -1;
- int mid = (p + q) / 2;
- if (v[mid] == x)
- return mid;
- return x > v[mid] ? binSrc(v, p, mid - 1, x) : binSrc(v, mid + 1, q, x);
- }
- int main() {
- //driver code comes here
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement