GATE CS 2018 · Question 41 · Algorithms · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer
Assume that multiplying a matrix G₁ of dimension p × q with another matrix G₂ of dimension q × r requires pqr scalar multiplications. Computing the product of n matrices G₁G₂G₃ … Gₙ can be done by parenthesizing in different ways. Define Gᵢ Gᵢ₊₁ as an explicitly computed pair for a given paranthesization if they are directly multiplied. For example, in the matrix multiplication chain G₁G₂G₃G₄G₅G₆ using parenthesization (G₁(G₂G₃))(G₄(G₅G₆)), G₂G₃ and G₅G₆ are the only explicitly computed pairs.
Consider a matrix multiplication chain F₁F₂F₃F₄F₅, where matrices F₁, F₂, F₃, F₄ and F₅ are of dimensions 2 × 25, 25 × 3, 3 × 16, 16 × 1 and 1 × 1000, respectively. In the parenthesization of F₁F₂F₃F₄F₅ that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are
- (A) F₁F₂ and F₃F₄ only
- (B) F₂F₃ only
- (C) F₃F₄ only
- (D) F₁F₂ and F₄F₅ only
Answer
Answer (C)
Answer from the official GATE CS 2018 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes