Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  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 M1 × M2 will be
    1. best if A is in row – major, and B is in column major order
    2. best if both are in row – major order
    3. best if both are in column – major order
    4. independent of the storge scheme
Correct Option: D

Since the matrices are stored in array, there is no dependence of time complexity on row major or column major. Here only the starting address is known & on the basis of indexes the next memory locations are calculated.
Hence (d) is correct option.



Your comments will be displayed only after manual approval.