Sunday, December 11, 2011

Given an array of unsigned integers which is initially increasing (value of integers)and then decreasing find the maximum value in the array


1 comment :

Anonymous said...

Use Binary Search. Find the mid element. if(Arr[mid] > Arr[Mid-1] && Arr[mid]>Arr[mid+1]) return mid. else if (Arr[mid] > Arr[mid-1] && Arr[mid]< Arr[mid+1]) low = mid+1
else high = mid-1.revise the search.