-1

Here's the code I've implemented in a nutshell.

for(i= 1;i<=n;i++){
    for(j = 1;j<=i;j++){
        for(k = 1;k<=j;k++){
            k = k*2;
        }
    }
}

for(int i = 1; i <= n; i = 2*i){
    for(int j = 1; j <= i; j = 2*j){
        for(int k = 0; k <= j; k++){
            // Some elementary operation here.
        }
    }
}

I have now analyzed that the time complexity of the first code fragment is O(n*n*log(n)), but I can't figure out which one comes after it。Although this question has been answered here, But I didn't figure out why this.

HanXin
  • 11
  • 2
  • Does this answer your question? [Time complexity analysis of algorithm](https://stackoverflow.com/questions/36862922/time-complexity-analysis-of-algorithm) – Yusuf May 12 '22 at 14:39

0 Answers0