1

I am having trouble figuring out the tight bound and the lower bound for this pseudocode. Could anyone help ?

Array S;

for i <-- 0 to n-1
  for j <-- 0 to n-1 
    for k <-- 0 to n-1 
       M[i][j] = M1[i][k]*M2[k][j]
return M

Thanks!

1
  • 2
    You might be better off at cs.stackexchange.com with this question. Commented Mar 5, 2015 at 3:07

1 Answer 1

4

Three nested loops and no options to end early would mean a complexity of n^3, best and worst case are the same.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.