A CFG(Context Free Grammar) is said to be in Chomsky Normal Form (CNF), if all the productions are of the form A -> BC or A -> a. Let G be a CFG in CNF. To derive a string of terminals of length x, the number of products to be used is
(A) 2x – 1
(C) 2x + 1
Explanation: A context free grammar (CFG) is said to be in Chomsky Normal Form (CNF) if all production rules satisfy the following conditions given below as :-
- A non-terminal symbol generate a terminal Symbol (e.g.; A->b)
- A non-terminal symbol generate two non-terminals symbol adjacently (e.g.; S->AB)
- Start symbol generating ?.(e.g.; S-> ε) and For generating string w of length ‘x’ requires ‘2x-1’ production or steps in CNF because in CNF at every step only 1 terminal can replace a variable.
Option (A) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.