Given algorithm:
The inner loop is:
And the outer loop is: $\frac{n(n+1)}{2} * n$ but in the answer is says that I don't need to multiply it by $n$. Can anyone explain why the series is enough for the two outer for loops?
Given algorithm:
The inner loop is:
And the outer loop is: $\frac{n(n+1)}{2} * n$ but in the answer is says that I don't need to multiply it by $n$. Can anyone explain why the series is enough for the two outer for loops?
Outer loop complexity: $$\sum_{i=1}^n\sum_{j=1}^i1=\sum_{i=1}^ni=\frac{n(n+1)}{2}$$