Consider that I have an array of sorted numbers with 0 to N-1 offset where N is the lenght of the array. A completely sorted array has 0 zero offset as given below
[1, 2, 4, 11, 15, 19, 26]
An array [19, 26, 1, 2, 4, 11, 15]
has an offset of 2 as the smaller number starts from 2nd index and wrapping around to the first.
The assignment question is how to find an index of a number in array. For a sorted array, the solution would obviously be a binary search to find the index (with or without recursion).
How do you find the index of a number in an array with an offset? The offset is not known. I would like an outline for the solution and I will try to implement it in a language I am comfortable in.