UGC-NET Dec 2014 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0041

Consider the problem of a chain $\langle A_{1}, A_{2}, A_{3}\rangle$ of three matrices. Suppose that the dimensions of the matrices are $10 \times 100$, $100 \times 5$ and $5 \times 50$ respectively. There are two different ways of parenthesization : (i) $((A_{1} A_{2} )A_{3} )$ and (ii) $(A_{1} (A_{2} A_{3}))$. Computing the product according to the first parenthesization is times faster in comparison to the second parenthesization.
  1. A
    $5$
  2. B
    $10$
  3. C
    $20$
  4. D
    $100$

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solution\[\boxed{\text{cost of }(p\times q)(q\times r)=pqr}\](i) \(((A_1A_2)A_3)\):\[10\cdot100\cdot5+10\cdot5\cdot50=5000+2500=7500.\](ii) \((A_1(A_2A_3))\):\[100\cdot5\cdot50+10\cdot100\cdot50=25000+50000=75000.\]\[\frac{75000}{7500}=10,\]so the first parenthesization is 10 times faster.Answer: B

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com