public void m1(int n) {
sum = 0;
for (int i = n/2; i <= n; i++) {
for (int j = 1; j <= n; j = 2 * j) {
for (int k = 1; k <= n; k = k * 2) {
sum++;
}
}
}
}
So, I know that the innermost loop and second loop are $\log(n)$ and the outermost loop is essentially $O(n)$, so that means $O(n\log(n)\log(n))$. But I am lost on what to do next. I am between $O(n^2 \log(n))$ and $O(n \log^2(n))$. Can someone tell me which is right and explain why?