This is a pretty easy worst-case complexity question but i\'m having trouble gra
ID: 3719590 • Letter: T
Question
This is a pretty easy worst-case complexity question but i'm having trouble grasping the subject.
This question deals with a function designed to multiply two matrices. It's not necessary that you remember how matrix multiplication is done. The structure of the algorithm should be understandable.
A. O(1) B. O(a.numCols) C. O(a.numRows) D. O(b.numCols) E. O(i*j) F. O(j*k) G. O(j*a.numRows)
H. O(j*a.numCols) I. O(a.numCols*a.numRows) J. O(a.numCols*b.numCols) K. O(a.numCols^2)
L. O(a.numCols*a.numRows*b.numCols) M. O(a.numCols*a.numRows*b.numRows)
N. O(a.numCols*a.numRows*b.numCols*b.numRows) O. none of the above
You can choose a letter for each of the following:
line 10:
line 9-10:
line 11:
lines 8-11:
lines 6-12:
lines 5-12:
line 4:
lines 4-13:
Explanation / Answer
line 10:B. O(1)
line 9-10:B O(a.numCols)
line 11:I. O(a.numCols*a.numRows)
lines 8-11: O(a.numCols*a.numRows)
lines 6-12:. O(a.numCols*b.numCols)
lines 5-12:L. O(a.numCols*a.numRows*b.numCols)
line 4:J. O(a.numCols*b.numCols)
lines 4-13:L. O(a.numCols*a.numRows*b.numCols)