The correct answer is D) independent of the storage scheme.
Why Asymptotic Complexity is Independent of Storage
From a purely theoretical, asymptotic complexity perspective, the way a matrix is stored in memory does not change the total number of fundamental operations (multiplications and additions) required to compute the result.
The standard algorithm for multiplying two
matrices always performs:
multiplications
additions
Regardless of whether the matrices are stored in row-major or column-major order, this exact number of arithmetic operations must be performed.
Practical Performance vs. Theoretical Complexity
- Performance: In the real world, matching the storage layout to the access pattern (
A row-major, B column-major) drastically improves performance by reducing cache misses. This is a crucial concept in systems programming and performance optimization.
Theoretical Complexity: GATE questions on this topic are typically asking about the fundamental asymptotic complexity, which only counts the number of operations as a function of
. In this context, memory access time is considered constant for each operation, so caching effects are ignored.
Therefore, since the number of operations is always the same, the asymptotic time complexity is independent of the storage scheme.