简体   繁体   中英

dynamic programming - optimal break point

I learned that using dynamic programming, the matrix chain multiplication problem can be solved in n^3 time, while for the optimal binary tree problem, we also get n^3 time, but then we could optimize it to n^2. Why is this? I got a statement saying that this is because in the matrix multiplication problem, the optimal break point of the chain M(i,n) could be larger than the optimal break point of the chain M(i+1,n). Can someone help me understand this? Why is this true in the matrix multiplication problem, but not in the optimal binary tree problem?

Thanks

Given an interval of keys I1 that is a sub-interval of I2, the query cost of the optimal binary tree on I1 is no greater than the query cost of the optimal binary tree on I2 (this should be fairly intuitive, but formally, take the optimal tree for I2 and repeatedly delete keys from it via the standard algorithm). This means that you can think of the process of finding the optimal break point as a sort of balancing process between the two halves.

This is not true for matrix chain: the cost of multiplying (100, 100), (100, 100) is much greater than (100, 100), (100, 100), (100, 1), because two matrix-vector multiplications is much cheaper than a matrix-matrix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM