## Question

A1: 2 by 20, A2: 20 by 4, A3: 4 by 5, A4: 5 by 15.

Run the dynamic programming algorithm given in class to find the minimum number of additions and multiplications to calculate A1 A2 A3 A4. Write all the values of B(i, k). Also justify the last step: State why your final answer is correct in more than 3 and less than 15 lines, explaining your reasoning in English with formulas.

Write the minimum number of operations to calculate A1 A2 A3 A4 and the values of the calculation table.

2) Consider the following graph.

G=(V, E), V={a, b, c, d, e, f, g, h, i},

E={(a,b), (a,d), (a,e), (b,c), (c,e), (c,f), (d,e), (d,g), (d,h), (e,f), (e,h), (e,i) (g,h), (h,i)}

It is edge-weighted by the following function.

w:E→Z^+, w(a,b)= 1, w(a,d) = 3, w(a,e)=3, w(b,c)=2, w(c,e)=2, w(c,f)=1,

w(d,e)=3, w(d,g)=1, w(d,h)=2, w(e,f)=3, w(e,h)=4, w(e, i)=4

w(g,h)=3, w(h,i)=1

Draw the graph G as a figure and insert it below.

Then run the MST algorithm given in class on G to construct a minimum spanning tree of G. Color in red the edges of the obtained spanning tree. You can insert a separate figure, or show your work in the figure for a.

What is the total edge weight of the minimum spanning tree?

How many spanning trees of the minimum weight does G have? Justify your answer in English in more than 3 and less than 15 lines. You can use the following proposition:

Proposition: The algorithm MST(G) given in class can produce any minimum spanning tree of G

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Problem 1Nested-loop execution:

k=i=1 => B(1,1) = B(1,0) + B(2,0) + 2*p1*p2*p3 = 0 + 0 + 2*2*20*4= 320

k=1, i=2 => B(2,1) =B(2,0) + B(3,0) + 2*p2*p3*p4 = 0 + 0 + 2*20*4*5 = 800

k=1, i=3 => B(3,1) = B(3,0) + B(4,0) + 2*p3*p4*p5 = 0 + 0 + 2*4*5*15= 600

Then when k=2 and i=1, m can be only 1:

B(1,2) = B(1,1) + B(3,0) + 2*p1*p3*p4 = 320 + 0 + 2*2*4*5 = 400...

By purchasing this solution you'll be able to access the following files:

Solution.docx.