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