GATE Computer ScienceHardGATE CSE · UGC NET

Six matrices have dimensions given by the sequence 5, 10, 3, 12, 5, 50, 6 (matrix i is p[i-1] × p[i]). The minimum number of scalar multiplications needed for the full product is

  1. A. 3380
  2. B. 2010
  3. C. 2340
  4. D. 1530

Correct answer: B. 2010

Matrix-chain DP gives m[1][6] = 2010; multiplying strictly left to right costs 3380.

More Algorithms questions

Exams that ask this topic