Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CircularSortedArrSrc(int v[], int n, int x)
- {
- int st = 0, dr = n - 1,mid;
- while (st <= dr)
- {
- mid = (st + dr)/2;
- if (v[mid] == x)
- return true;
- if (v[mid] <= v[dr])
- {
- if (x > v[mid] && x <= v[dr])
- st = mid + 1;
- else
- dr = mid - 1;
- }
- else
- {
- if (v[st] <= x && x < v[mid])
- dr = mid - 1;
- else
- st = mid + 1;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement