class Solution {

public:

bool search(int A[], int n, int target) {

int low = 0;

int high = n;

```
while(low <= high)
{
int mid = (low + high)/2;
if(A[mid] == target) return true;
if(A[mid] > A[low])
{
if(target >= A[low] && target < A[mid])
high =mid-1;
else
low = mid+1;
}
else
{
if(target > A[mid] && target < A[low])
low = mid+1;
else
high = mid-1;
}
}
return false;
}
```

};