GATE Computer ScienceHardGATE CS (PYQ pattern)
A grammar in Chomsky normal form (no ε-productions) derives a string of length 15. Let N be the number of derivation steps and H the minimum possible height of its parse tree (height = number of edges on the longest root-to-leaf path, leaves being terminals). What are N and H?
- A. N = 29, H = 5
- B. N = 29, H = 4
- C. N = 30, H = 5
- D. N = 15, H = 4
Correct answer: A. N = 29, H = 5
Each terminal needs one A → a step (15) and building 15 variable-leaves from one root needs 14 A → BC steps: N = 29. The A → BC part is a binary tree with 15 leaves, whose depth is at least ⌈log₂ 15⌉ = 4; one more edge reaches the terminal, so H = 5 (4 forgets the terminal edge).
More Theory of Computation questions
- A grammar in Greibach normal form generates a string of length 15. How many derivation steps does any derivation of it take?
- A grammar has only rules of the forms A → BC, A → BCD (three variables) and A → a. A parse tree of a string of length 9 uses exactly two…
- Which of the following computational models is strictly LESS powerful than a standard single-tape deterministic Turing machine?
- Which of the following problems for a linear bounded automaton (LBA) M and a string w is decidable?
- Let L = { aⁿbⁿ : 0 ≤ n ≤ 3 } over {a, b}. How many Myhill–Nerode equivalence classes does L have (equivalently, how many states does its…
- Which of the following languages is inherently ambiguous?