eg : original : 0 1 2 3 4
corrupted : 3 4 0 1 2
this can be done as below..
compare the middle element with first and the last element..
if middle < first
chk for first half
else
chk for second half
above eg.
middle = 0
first = 3
last = 2
as 0<3
consider 3 4 0
middle = 4
first = 3
last = 0
as 4>3
consider 4 0
for 2 elements
simply find the index of min element
now u have the index of 0 in log(n).
Sahil Garg
Computer Engg. DCE
On Thu, Sep 22, 2011 at 1:31 PM, siva viknesh <[email protected]>wrote:
> eg : original : 0 1 2 3 4
> corrupted : 3 4 0 1 2
>
--
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.