After finding the pivot, can't we just use the normal binary search,
just change the array notation to use modular arithmetic.

i.e, instead of arr[i], use arr[(i+k)%n], where n is the number of
elements in the array. Rest of the code remains same.

On Sun, Aug 14, 2011 at 10:41 AM, sagar pareek <[email protected]> wrote:
> arey mean original array.....
> array without rotation :D
> and if u know the pivot point then how u will came to know its position in
> rotated array...
> like in above example
> we have to search 12
> then how will u know abt position of 2?
>
> On Sun, Aug 14, 2011 at 6:15 AM, Yasir <[email protected]> wrote:
>>
>> @Sagar
>> "..an array which is sorted but rotated by some k places which is nt kwn"
>> Kindly note that:  ARRAY IS KNOWN,  k is NOT known.
>>
>> If the array is not known then where will you search an item???   :P  :P
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/TfoI2uYkGCAJ.
>> 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.
>
>
>
> --
> Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
> --
> 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.
>



-- 
Gaurav Menghani

-- 
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.

Reply via email to