Give an example of a context free language L that, for any CFG with language L,
ID: 3111250 • Letter: G
Question
Give an example of a context free language L that, for any CFG with language L, required at least 2 variables. Prove that there is no CFG for L with only 1 variable. Consider the string a^n for some integer n. The language {a^n} clearly is regular, and hence is context free. A simple CFG for it is S rightarrow a .. a. We will consider the complexity of a^n to be the following: we sum for every rule the number of variables and terminals in that rule as well as the rightarrow symbol. For example, the complexity of a^n is at most n + 2 since the grammar above has 1 variable, n occurrences of the symbol a, and one rightarrow symbol. We can improve this in some cases. For a^9, we can make the grammar S rightarrow BBB, B rightarrow aaa, which has 5 variable occurrences, 2 rightarrow occurrences, and 3 terminals, which sums to 10. For what can we have a better complexity than n + 2, and what n require n + 2. What a program to generate the complexity for all n lessthanorequalto 100. Discuss how you designed your program, as well as discuss what you believe the " Correct" answer is. For extra bonus points, give some complexities for much larger n.Explanation / Answer
the exact stumuli given by the designer perfectly well ..once you observe at those variabpe assumptions they are pretty enough to arrive at a perfect solution
that n value cna be any atbitrary so as to satisfy that n less than 100
CFG had got better reduced complexity
its correct appreciated approach
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.