~/ learn/ comp-372/ cards/ Matrix-chain multiplication
1 of 4

The matrix-chain recurrence (type it)

The matrix-chain recurrence (type it)

Answer

m[i,i] = 0 m[i,j] = min over i <= k < j of m[i,k] + m[k+1,j] + p[i-1]*p[k]*p[j] # fill in order of increasing chain length l = 2..n

For every split k, the cost is the two sub-products plus the final multiply p[i-1]·p[k]·p[j]. The fill order (by chain length) guarantees both sub-costs are already known.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/129ad0e3-da30-4b49-b550-05081e83f9a8/flashcard utf-8 LF