Question 77Asked in UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)

Let G = (V, T, S, P) be a context-free grammar such that every one of its productions is of the form A → v, with |v| = k > 1. The derivation tree for any…

Let G = (V, T, S, P) be a context-free grammar such that every one of its productions is of the form A → v, with |v| = k > 1. The derivation tree for any string W ∈ L(G) has a height such that
  1. Ah < (|W| – 1)/(K – 1)
  2. Blogₖ |W| ≤ h
  3. Clogₖ |W| < h < (|W| – 1)/(K – 1)
  4. Dlogₖ |W| ≤ h ≤ (|W| – 1)/(K – 1)
Show answerHide answer

Correct answer: (D) logₖ |W| ≤ h ≤ (|W| – 1)/(K – 1)

Explanation

Each internal node of the derivation tree has exactly k children. The tree is shortest when it is complete, giving h ≥ logₖ |W|, and tallest when each level has only one internal node, giving h ≤ (|W| – 1)/(k – 1). So logₖ |W| ≤ h ≤ (|W| – 1)/(k – 1).

From UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions)

This is question 77 of UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.