Please give review to this post http://rawjava.blo…
Unknown - Apr 1, 2015
Please give review to this post
http://rawjava.blogspot.com/2015/04/java-program-to-find-maximum-number.html
Good question and equally good answer..Enjoyed your post :)
Unknown - Apr 1, 2015
Please give review to this post
http://rawjava.blogspot.com/2015/04/java-program-to-find-maximum-number.html
Good question and equally good answer..Enjoyed your post :)
shanky - Nov 0, 2014
for(int j=arrIndex/2 ; j < arrIndex;j++)
{
if(array[j]==1)
return j;//this is our index
}
This makes the approach O(n)
Do a regular binary search after finding the cap , with range i/2 to i
Hi Shanky, you are right. That’s what I have done :)
Anonymous - Sep 4, 2014
def findMin(arr):
print(“Finding min in a rotated sorted array of integers”)
low = 0
high = len(arr) - 1
while low < high:
mid = int((low + high)/2)
left = mid - 1
right = high
if arr[mid] > arr[left] and arr[mid] > arr[right]:
low = mid
elif arr[mid] > arr[left] and arr[mid] < arr[right]:
high = mid
else:
return arr[mid]