Matrix chain multiplication: Difference between revisions

Content added Content deleted
mNo edit summary
mNo edit summary
Line 22: Line 22:
* [1000, 1, 500, 12, 1, 700, 2500, 3, 2, 5, 14, 10]
* [1000, 1, 500, 12, 1, 700, 2500, 3, 2, 5, 14, 10]


To solve the task, it's possible, but not required, to write a function that enumerates all possible ways to parenthesize the product. This task is a classic example of [[:wp:Dynamic programming|dynamic programming]].
To solve the task, it's possible, but not required, to write a function that enumerates all possible ways to parenthesize the product. This is not optimal because of the many duplicated computations, and this task is a classic application of [[:wp:Dynamic programming|dynamic programming]].


See also [[:wp:Matrix chain multiplication|Matrix chain multiplication]] on Wikipedia.
See also [[:wp:Matrix chain multiplication|Matrix chain multiplication]] on Wikipedia.