Matrix chain multiplication: Difference between revisions
m
→Iterative solution
m (→{{header|Go}}: more accurate code comment) |
|||
Line 707:
=== Iterative solution ===
In the previous solution, memoization is done blindly with a dictionary. However, we need to compute the optimal products for all sublists. A sublist is described by its first index and length (resp. i and j+1 in the following function), hence the set of all sublists can be
<lang python>def optim4(a):
|