GATE 2019 CS – Question 41
Which one of the following languages over $\Sigma=\{a,b\}$ is NOT context-free?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) $\{wa^nw^Rb^n\mid w\in\{a,b\}^*,\ n\ge0\}$
Explanation
A pushdown automaton can match $ww^R$ (A), match $w$ with $w^R$ around a nested $a^nb^n$ (B), and pick one of three options for $i$ non-deterministically (D). In C the $w^R$ and $b^n$ are interleaved (crossing dependencies), which needs two independent counters, so C is not context-free.