ALGORITHMS

Matrix Chain Multiplication (MCM)

Let, there are N matrices their dimension looks like: (p[0], p[1]), (p[1], p[2])... (p[N-1], p[N])

MCM(i, j) = 0                                                         if i == j
MCM(i, j) = min( MCM(i, k) + MCM(k+1, j) + p[i-1] * p[k] * p[j] )     if i < j
            i <= k < j

Desired Solution : MCM(1, N)

Continue reading...