You have a chain of matrices and the dimensions of the matricesshown below…
Matrix(Dimension): A1(10×5) A2(5×8) A3(8×3) A4(3×15)A5(15×6)
Using the Memoized-Matrix Chain algorithm, findthe optimal parenthesization of the given chain.Show the status of the stack that storesthe recursions when a PUSH operation takes place.Each stack member should be the latter two Lookup-Chain argumentsfor low and high indices written in parenthesis. Write thecorresponding m table entry that is computed as thealgorithm is executed.
Start of tracing:
(1,1)(1,5)(1,1)=0(1,n)
Fill in the rest of the stacks using however many youneed
M Table (fill in the indices)
m
Show the optimal parenthesization for the givenmatrix chain by adding parentheses:
A1 A2 A3 A4
OR
OR