The language is
View worked solution
Answer: B
The given language is .
1. Why is not Regular?
To recognize strings in , we need to remember the count of 's () and 's () to ensure that the number of 's is exactly . Since and can be arbitrarily large, a Finite Automaton (which has finite memory) cannot keep track of these counts. Thus, is not regular.
2. Why is Context-Free?
We can design a Pushdown Automaton (PDA) that uses a single stack to accept as follows:
- For every read from the input, push a symbol onto the stack.
- For every read from the input, push a symbol onto the stack. At this point, the stack contains copies of at the bottom and copies of on top.
- When 's start arriving:
- Pop a for each of the first 's.
- Pop an for each of the next 's.
- If the input is completely consumed and the stack is empty (except for the initial stack symbol), accept the string.
Therefore, the language is context-free but not regular.
Free practice · Your answers on this page are not saved.
