- GATE CS
- 2026–27 pattern practice
- Algorithms
- Dynamic programming
- Medium
Matrices A (), B () and C () are to be multiplied as ABC. What is the minimum number of scalar multiplications needed?
Algorithm Design
Pick an option to check your answer.
Answer: A. Solution
There are two parenthesisations. costs . costs . The minimum is , which is what the matrix-chain DP finds.
Why not the others
- is the cost of , the worse order.
- is only the cost of computing BC.
- is only the cost of computing AB.