Menu

[Solved]Question 1 35 Points Matrix Chain Multiplication Matrix Chain Order P Array M L N Plength Q37130507

Question 1 (3.5 points) Matrix chain multiplication MATRIX-CHAIN-ORDER (p) array m l n-p.length -1 2 let m[1..n, 1..n] and s[

Question 1 (3.5 points) Matrix chain multiplication MATRIX-CHAIN-ORDER (p) array m l n-p.length -1 2 let m[1..n, 1..n] and s[1..n -1,2..n] be new tables 3 for-1 to n 4 5 for2 to in // l is the chain length fori -1 ton-l 1 j–1 for k-i to j-1 10 12 14 return m and s 0 0 0 ml, Let RLj] be the number of times that table entry mLj] is referenced while computing other table entries in a call of MATRIX-CHAIN-ORDER. a) In computing m[1,3], how many other entries are referenced? What are they? Which entries are referenced exactly once? b) What are R[1,1], R[2,2], R[3,3], R[4,4]? c) Let N, be the number of iterations executed in the i-loop. Express Ni with n and 1. Let Nk be the number of iterations executed in the k-loop. Express Nk with 1 d) Within each iteration of the k-loop, m is referenced twice. Therefore, the total number of times that m is referenced is Σ-N, Nk . 2 Show that Σ_2 NiNk . 2 = n Hint: You will find the equation Σ-1 n 2i2 -n(2n+1) useful 6 Show transcribed image text Question 1 (3.5 points) Matrix chain multiplication MATRIX-CHAIN-ORDER (p) array m l n-p.length -1 2 let m[1..n, 1..n] and s[1..n -1,2..n] be new tables 3 for-1 to n 4 5 for2 to in // l is the chain length fori -1 ton-l 1 j–1 for k-i to j-1 10 12 14 return m and s 0 0 0 ml, Let RLj] be the number of times that table entry mLj] is referenced while computing other table entries in a call of MATRIX-CHAIN-ORDER. a) In computing m[1,3], how many other entries are referenced? What are they? Which entries are referenced exactly once? b) What are R[1,1], R[2,2], R[3,3], R[4,4]? c) Let N, be the number of iterations executed in the i-loop. Express Ni with n and 1. Let Nk be the number of iterations executed in the k-loop. Express Nk with 1 d) Within each iteration of the k-loop, m is referenced twice. Therefore, the total number of times that m is referenced is Σ-N, Nk . 2 Show that Σ_2 NiNk . 2 = n Hint: You will find the equation Σ-1 n 2i2 -n(2n+1) useful 6

Expert Answer


Answer to Question 1 (3.5 points) Matrix chain multiplication MATRIX-CHAIN-ORDER (p) array m l n-p.length -1 2 let m[1..n, 1..n] a… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *