GATE CS 1990 · Arrays & Matrix Representation

MSQ · 1 mark · Problem PROG-DSTR-0276

The number of rooted binary trees (distinct shapes, nodes unlabelled) with \(n\) nodes is (more than one may be correct)
  1. A
    equal to the number of ways of multiplying \((n+1)\) matrices.
  2. B
    equal to the number of ways of arranging \(n\) out of \(2n\) distinct elements.
  3. C
    equal to \(\dfrac{1}{n+1}\dbinom{2n}{n}\).
  4. D
    equal to \(n!\).

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solution\[\boxed{b_n=\sum_{k=0}^{n-1} b_k\,b_{n-1-k}=\frac{1}{n+1}\binom{2n}{n}}\]A tree is a root with a left subtree of \(k\) nodes and a right subtree of \(n-1-k\) nodes, which gives the Catalan recurrence.(A) True: fully parenthesising a product of \(n+1\) matrices splits it at the last multiplication into two products, which gives the same recurrence and the same Catalan number.(B) False: \(\dfrac{(2n)!}{n!}\) is far larger (12 for \(n=2\), against 2 trees).(C) True: the closed form of the Catalan number.(D) False: \(n=3\) gives 5 trees but \(3!=6\).The key published with this item gave only A; C is the same Catalan number.Answer: A, C

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