GATE Computer ScienceHardGATE CS (PYQ pattern)

Among all full parenthesisations of the product A₁A₂A₃A₄A₅A₆A₇, how many contain the product (A₃A₄) as one of their sub-products?

  1. A. 132
  2. B. 42
  3. C. 70
  4. D. 14

Correct answer: B. 42

If A₃A₄ is computed as a unit, it behaves like a single matrix, so the chain has 6 factors and there are C₅ = 42 parenthesisations. All 7-factor parenthesisations number C₆ = 132; 70 counts those containing (A₃A₄) or (A₅A₆); 14 those containing both.

More Algorithms questions

Exams that ask this topic