To search for element T in array A[], start at a point p > 0.
If A[p] > T, do a binary search on range 0..p.
Otherwise set p = 1 + p * (T - A[0]) / (A[p] - A[0]).
Repeat until A[p] >= T. Then the current and previous values of p are
an interval containing T (if T is in A).
Do a binary search on that interval.
Don

On Sep 29, 6:59 am, pooja <pooja27tan...@gmail.com> wrote:
> Given a sorted Array of infinite length.. what is the most optimum way
> to search for an element. We hane no idea about its length..

-- 
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?hl=en.

Reply via email to