21. Dynamic Programming 4

2017-10-10  本文已影响0人  何大炮

Matrix-chain multiplication problem

There are 2 matrix, A[m* n] and B[n* l], then we do multiplication A* B = C[m* l]
there are m* l * n scalar multiplications existing.
Let assume: A * B *C * D * E...... find a multiplying order so that the number of scalar multiplications is smallest.


For this problem, we use s[i,j] as the a record of execution, and use the recursion to calculate from small to large.

上一篇下一篇

猜你喜欢

热点阅读