+1 vote
for (int i = 1 to n) {

  for (int j = i*i to n) {

    for (int k = j*j to n) {

      sum += a[i]*b[j]*c[k]

    }

  }

}
in Asymptotic Analysis by AlgoMeister (1.6k points)

1 Answer

0 votes

For the innermost loop to execute, the condition j≤ n must hold, meaning j ≤ n0.5.

In the middle loop, j ranges from i2 to n. Since j ≤ n0.5, the range for j is from i2 to n0.5. For the middle loop to run, the condition i≤ n0.5 must be satisfied, which implies i ≤ n0.25.

Therefore, the outer loop runs from i = 1 to i = n0.25.

Thus, the total time complexity is n0.25⋅n0.5⋅n = O(n1.75) or O(n7/4).

by (124 points)
The Book: Analysis and Design of Algorithms | Presentations on Slideshare | Lecture Notes, etc
...