@Preetika: If a[0] < a[SizeOfList-1], then n = 0. Otherwise, use a binary search to find i, 1 <= i < SizeOfList, such that a[i-1] > a[i], and set n = i.
Dave On Oct 28, 6:49 pm, preetika tyagi <[email protected]> wrote: > *A “rotated array” is an array of integers in ascending order, after which > for every element i, it has been moved to element (i + n) mod sizeOfList. > Write a function that takes a rotated array and, in less-than-linear time, > returns n (the amount of rotation). > > * -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
