I know that this platform is probably not the best place for this question, on stack overflow I didn't receive any answers. Consider the following code snippet:
for (int i = n; i >= 1; i = i / 2) {
for (int j = 1; j <= i; j = 2 * j) {
f();
}
}
We want to determine the number of times f() get's called. My solution: $$ \sum_{i=1}^{\log _{2}(n)} \sum_{j=1}^{\log _{2}(i)} 1 = \sum_{i=1}^{\log _{2}(n)} \log _{2}(i)$$ Apparently the solution is $\Theta(\log^2(n))$, how can I reduce the above further?