0

I have an algorithm like the following

for(int k) {
    statement1;
    for(int j) {
        statement2;
    }
    for(int m) {
        statement3;
    }
 }

j => m

Is it correct for me to conclude that the complexity class is O(n^2)?

  • 2
    Sure it looks like O(k * max(j, m)) = O(k * j) using the constraint, but this pseudo-code doesn't give much information. – sascha May 30 '16 at 14:11
  • You'll have to edit the question to tell us what the range of k, j, and m are. The answer will depend on the answer to that. Anyway, it looks like this is covered by our reference material. – D.W. May 31 '16 at 03:39

0 Answers0