-1

I just need to check my understanding of how to analyze big - O complexity. Is this algorithm N^2 or N^3? I'm aware of the many online resources explaining how to analyze an algorithm. I'd like to confirm my understanding.

for(int i=0; i<n; i++)
 for(int j=0; j<n*n; j++)
 sum++

1 Answers1

0

O(n^3) absolutely.

and T(n) = Ω(n^3).  
so T(n) = θ(n^3).`
intboolstring
  • 6,891
  • 5
  • 30
  • 44
lililqth
  • 378
  • 1
  • 3
  • 7