Re: [algogeeks] Whats the complexity?

2011-07-20 Thread Ankur Khurana
when n is not defined , you want complexity in terms of ?

On Wed, Jul 20, 2011 at 3:16 PM, Dumanshu  wrote:

> Given an infinite length list. u got to find index of an element k.
> use this approach-
> initially, take length as 2^x where x increases from 1 to ...
> while (still not found)
> {
> now if arr[2^x-1] < k,
>  increment x
> else
> binarysearch on length 2^(x-1) to 2^(x)
> }
>
> Please help me to find the complexity of this particular approach...
>
> --
> 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.
>
>


-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

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



[algogeeks] Whats the complexity?

2011-07-20 Thread Dumanshu
Given an infinite length list. u got to find index of an element k.
use this approach-
initially, take length as 2^x where x increases from 1 to ...
while (still not found)
{
now if arr[2^x-1] < k,
 increment x
else
binarysearch on length 2^(x-1) to 2^(x)
}

Please help me to find the complexity of this particular approach...

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