Similar questions 2 more →
Dynamic Programming

Answer & solution
Official answer: 1500.0 : 1500.0
Our answer: 1500
Step through it (8 steps)
Use A1((A2A3)A4): A2A3 costs 5·20·10=1000 and yields 5×10; multiplying A4 costs 5·10·5=250 and yields 5×5; multiplying A1 costs 10·5·5=250. Total 1500. The five full parenthesizations cost 1750, 1500, 3000, 2000, 3500, so 1500 is minimal.
Matrix-chain DP uses M(i,j)=min over k of M(i,k)+M(k+1,j)+di−1dk dj, with M(i,i)=0. For d=(10,5,20,10,5), two-matrix costs are 1000,1000,1000; three-matrix optima are M(1,3)=1500 and M(2,4)=1250. Splitting the full chain after A1 then costs 1250+250=1500.