Matrix chain multiplication Flashcards
1
Q
If I do A(nxm) * B(m*k)
what is the dimensions of C
A
n x k
2
Q
How many ways to parenthesise a chain of n matrices
A
sum to n-1 i starts at 1
p(i)p(n-i)
p(1) = 1
3
Q
what is the run time of Matrix chain multiplication (with memoization)
A
O(n^3)
4
Q
what is the run time of Matrix chain multiplication (without memoization)
A
O(2^n)
thats how many ways there are to parentesize
5
Q
what is the recursive formula for matrix chain multiplication
A
m[i,j] -> min(m[i,k]+m[k,j]+ pi−1pkpj)
where i,k is the left sub chain
and k,j is the right sub chain
and pi-1pkpj is the cost to multiply the two
when p is in this form
p=[3,7,6,2,9]
chain of 3x7 * 7x6 .. etc
6
Q
A