I am trying to fully analyze the running time of $\texttt{nestedLoops}$ in terms of $n$ with a Theta bound.
The Java code I have is as follows:
public void nestedLoops(int n) {
int i = 1;
while (i < n) {
int j = i;
while (j > 1) {
int k = 0;
while (k < n) {
k += 2;
}
j = j // 2
}
i *= 2
}
}
I know that the innermost while loop has an obvious runtime of $\lceil \frac{n}{2} \rceil$. But I get stuck on the next while loops. I think the middle while loop has a runtime of $\lfloor \log_2\texttt{i} \rfloor$, but that is very confusing for me.
Any help would be taken with much gratitude.