ISRO Computer Science (CSE) 2023 - Question 45

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2023

Topic: Algorithms

The complexity of matrix multiplication of two matrices A and B whose orders are $m\times n$ and $n\times p$ respectively is

  • A. $O(m\times p)$
  • B. $O(m\times n^{2}\times p)$
  • C. $O(m\times n\times p^{2})$
  • D. $O(m\times n\times p)$

Answer: D. $O(m\times n\times p)$

Explanation: Matrix A is $m \times n$ and matrix B is $n \times p$. Multiplying them yields a matrix of order $m \times p$. Computing each of the $m \times p$ elements takes $O(n)$ time (multiplying a row by a column). Thus, the overall time complexity is $O(m \times n \times p)$.

| | All questions of ISRO Computer Science (CSE) 2023