it is a jus a try

i=1,j=2;
while (a[i]<a[j])
{
   j=i;
   i=i*2;
}

now we have i and j and we know that in between these indexes we have a
point z (n as u say) where

a[z-1]<a[z]
and a[z]>[z+1]

now apply the abive procedure between i and j

(its like binary search)

eg  we have m=50 and let n=24 (we dont know this value)

then for i=16 and j=32 this condition will break ..
now apply this logic in between 16 and 32.
if u find z(or say n) then we can find x easily..
i think i made my logic clear..

comment plz .

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

Reply via email to