isnt this logarithmic?    regular loop  1..n   runs in  n/(1 step each
time)  -> O(n)
this loop  n/(k + k^2 each time) ->   ln(n)/ ( ln(k) + k ln(2) )  ->
ln(n-k) ->  O(ln(n))   or something like that ;P   I was going from
memory.  Please confirm, but I feel like it approaches logarithmic
speed.

On Aug 25, 1:46 pm, sachin sabbarwal <algowithsac...@gmail.com> wrote:
> what will be the time complexity??
>
> sum=1
> for(k=0; k<n;  k = k+2^k)
>     sum=sum+sum;
> end
> print(sum);

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