Matrix multiplication


#1

Two matrices M1 and M2 are to be stored in arrays A and B respectively.Each array can be stored either in row-major or column-major order in contiguous memory locations.The time complexity of an algorithm to compute M1xM2 will be

A)best if Ais in row major order and B is in column major order.
B)best if both are in row major order.
C)best if both are in column major order.
D)independent of the storage scheme.


#2

D) Independent of the storage scheme.
Because all the arrays will be stored in RAM and the time to access any index would be constant.


#3

Option D is correct.
Row major and column major only changes the memory accessing patterns. And the process is time bound so the complexity remains same i.e. o(n^3)