• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 55

Assume that multiplying a matrix M1 of dimension a×b with another matrix M2 of dimension bxc requires abc scalar multiplications. Computing the product of n matrices M1M1M3 ... Mn can be done by parenthesizing in different ways. Define MiMi+1 as an explicitly computed pair for a given parenthesization if they are directly multiplied. For example, in the matrix multiplication chain M1M2M3M4M5M6 using parenthesization (M1(M2M3))(M4(M5M6)), M2M3 and M5M6 are only explicitly computed pairs. Consider a matrix multiplication chain A1A2A3A4, where matrices A1, A2, A3 and A4 are of dimensions 5x40,40×6,6x20 and 20×5 respectively. In the parenthesization of A1A2A3A4 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are

(A)

A1A2 and A3A4

(B)

A2A3 only

(C)

A3A4 only

(D)

A1A2 and A2A3

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments