I need some advice on how to determine the runtime of this loop :
s=0
for ( i=1 , i <= 2^m ; i=i*2 ) {
s++
}
return s
With
$C_1$ = actions performed once before entering the loop and
$C_2$ = actions performed one after entering the loop,
I see that $T(m) = C_1 + C_2 \cdot 2^m$.
How can I determine $T(m)$?
i
is changed after each iteration. – Raphael Apr 12 '15 at 10:02