for (i=1; i<=n ;i=i*2){
for (j=1; j<=i ;j++){
basic_step;
}
}
Regarding the above nested loops, I can't seem to understand why is the following runtime analysis is correct (specifically the first equality), when $k$ is defined as $\log i$, meaning $i=2^k$. What is the process that one should come up with, in order to decide this setting and the sigmas' indices? While I do understand that the outer loop runs for $\Theta(\log n)$ times, I still can't grasp the setting of $k$. A clarification will be very much appreciated!
$$\sum_{k=0}^{\log n}\sum_{j=1}^{2^k}1$$