Solution Review: The Matrix Chain Multiplication
In this lesson, we will solve the matrix chain multiplication problem with different techniques of dynamic programming.
Solution 1: Simple recursion #
Explanation
We can easily imagine dims to be a list of matrices. Then each recursive call tries to find the optimal placement of two parentheses between these matrices. So, let’s say we have the following sequence of matrices: . Each recursive call tries to place two parentheses, so we have the following possibilities: