```
public class Solution {
public int searchHelper(int[] A, int target, int start, int end){
if(start>end){
return -1;
}
int mid = (start+end)/2;
if(A[mid] == target){
return mid;
}
//Case 1: Left half is sorted
if(A[mid] >= A[start]){
if(target >= A[start] && target <= A[mid]){
return searchHelper(A,target,start,mid-1);
}
else{
return searchHelper(A,target,mid+1,end);
}
}
//Case 2: Right half is sorted
if(A[end]>=A[mid]){
if(target>=A[mid] && target<=A[end]){
return searchHelper(A,target,mid+1,end);
}
else{
return searchHelper(A,target,start,mid-1);
}
}
return -1;
}
public int search(int[] A, int target) {
return searchHelper(A,target,0,A.length-1);
}
}
```

Given the assumption of unique elements, there are 2 possibilities:

- Left half is sorted i.e. pivot is in right half
- Right half is sorted i.e. pivot is in left half

If target value is within the range of sorted half, binary search continues there.

Otherwise, binary search continues in the half with the pivot.