The main idea is to get the point at which the the rotation is made...It can be done in O(lgN) time complexity...
int get_pivot(int a [ ],int low, int high) { int mid = (low+high)/2; if(a[mid]>a[mid+1]) return (a[mid+1]); if(a[low]>a[mid]) return (get_pivot(a,low,mid-1)); else return(get_pivot(a,mid+1,high)); } On 5/28/11, Dumanshu <duman...@gmail.com> wrote: > Find an elegant way of getting the minimum value in a sorted array but > it has been rotated by some number. > say u had the array as 4 , 5, 6, 7, 8,9 and u rotate it by 2. u get > 6,7,8,9,4,5. Now u have to find minimum number in this modified array. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=100000655377926 * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.