### Rotation of an integer array

#includeusing namespace std; int findRotation(int arr[],int low,int high) { int mid; while(arr[low] > arr[high]) { mid = low+(high-low)/2; if(arr[mid] > arr[high]) low = mid+1; else high = mid; } return low; } int main() { //this is the array rotated by 2 positions int arr[]={5,6,1,2,3}; cout<<"rotation of array is"<<findRotation(arr,0,4); return 0; }

## Comments

## Post a Comment