Consider the following languages over the alphabet
Here, is the reverse of the string . Which of these languages are deterministic Context-free languages?
View worked solution
Answer: C
A language is a Deterministic Context-Free Language (DCFL) if and only if it can be accepted by a Deterministic Pushdown Automaton (DPDA).
Let's analyze each language individually:
- Language :
A DPDA can easily recognize this language. We push all incoming s onto the stack. When the first is encountered, the automaton deterministically switches to a popping state, matching each subsequent with a from the stack. Since there is no ambiguity about when to start popping, is a DCFL.
- Language :
The presence of the marker symbol '' clearly demarcates the boundary between and its reverse . A DPDA can push the characters of onto the stack, and upon reading '', deterministically switch to matching the remaining input with the stack symbols. Because the transition point is deterministic, is a DCFL.
- Language :
Unlike , there is no marker to indicate where ends and begins (for example, in the string , the split is not marked). A pushdown automaton must non-deterministically guess the midpoint to transition from pushing to popping. Thus, requires a Non-deterministic Pushdown Automaton (NPDA) and is not a DCFL (it is a CFL but not a DCFL).
Therefore, only and are deterministic Context-free languages.
Free practice · Your answers on this page are not saved.
