Matrix chain multiplication: Difference between revisions
Content added Content deleted
mNo edit summary |
m (→Python) |
||
Line 28: | Line 28: | ||
__TOC__ |
__TOC__ |
||
== Python == |
== Python == |
||
We will solve the task in three steps: |
|||
1) Enumerate all ways to parenthesize (in a recursive generator), and for each one compute the cost. Then simply look up the minimal cost. |
1) Enumerate all ways to parenthesize (in a recursive generator), and for each one compute the cost. Then simply look up the minimal cost. |