Home / Expert Answers / Computer Science / d-30-points-recall-that-the-standard-recursive-algorithm-recursive-matrix-chain-shown-in-figur-pa616

(Solved): (d) [ 30 Points ] Recall that the standard recursive algorithm Recursive-Matrix-Chain shown in Figur ...



(d) [ 30 Points ] Recall that the standard recursive algorithm Recursive-Matrix-Chain shown in Figure 1 runs in \Theta (3^(n)) time without using any space for memoization. But the memoized version of it as shown in Figure 3 (and as was shown in the class) runs in only \Theta (n^(3))p m[1..\pi ,1..\pi ]<= new table for l<1 to x do for ()/(s)=i toln do m[i,j]larr\infty m,p,1,2 m[i,j]< on then return m i,j if f=f then m[i,f]larr0 for klarri to j-1 do Loonup Crum (w)p,k+1,j (+)/(b)ar (p)_(1-1)vec(A)_(n)p_(j) if ,m[i,j]larrqp,1,nn1+2+3+dots+n=(1)/(2)n^(2)+(1)/(2)nm(1)/(2)n^(2)+(1)/(2)n\Theta (3^(n))Q then ,m[i,j]larrq return m[i.j] Figure 3: [Task 1] Memoized version of the Recursive-Matrix-Chain ( p,1,n ) function shown in Figure 1(a) that finds the smallest number of scalar multiplications required to multiply a chain of n matrices. time using 1+2+3+dots+n=(1)/(2)n^(2)+(1)/(2)n units of space (i.e., cells of table m ) for memoization. Can you combine the two algorithms to design a new one that uses asymptotically less space than (1)/(2)n^(2)+(1)/(2)n for memoization but runs asymptotically faster than \Theta (3^(n)) ? Explain your algorithm, write pseudocode, and show your analysis. RECURSIVE-MATRIX-CHAIN (p,i,j) if i=j then return 0 qlarr\infty for klarri to j-1 do ReCURSIVE-MATrix-Chain (p,k+1,j) return q


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe