GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 2(xviii)

Length of a CNF derivation

Theory of Computation · Context-Free Grammars & Languages · Full GATE CSE 1992 paper

GATE 1992, Q2(xviii) MSQ
Report issue

Context-Free Grammars & Languages

Question 2(xviii), GATE 1992: For a nonempty word w of length ℓ in a Chomsky-normal-form grammar, how many production applications derive it?
Question 2(xviii), GATE 1992: For a nonempty word w of length ℓ in a Chomsky-normal-form grammar, how many production applications derive it?
Tap to enlarge
Select all that apply
Answer & solution

Answer: C: 2ℓ−1 (no official key was published)

A CNF parse tree uses binary nonterminal productions A→BC and terminal productions A→a. There are ℓ terminal-producing leaves. A full binary tree with ℓ leaves has ℓ−1 binary internal nodes, so the total applications are ℓ+(ℓ−1)=2ℓ−1. The order of expanding variables does not change that count. The special ε-production sometimes allowed for the start symbol is outside this nonempty-word case; substituting ℓ=0 into the formula would not count its derivation correctly.

Original paper, page 4