Matrix chain multiplication: Difference between revisions
Content added Content deleted
mNo edit summary |
m (→Python) |
||
Line 84: | Line 84: | ||
=== Recursive cost optimization === |
=== Recursive cost optimization === |
||
The previous function optim1 already used recursion, but only to compute the cost of a given parens configuration, whereas another function (a generator actually) provides these configurations. Here we will do both recursively in the same function, avoiding the computation of configurations altogether. |
|||
<lang python>def optim2(a): |
<lang python>def optim2(a): |