GATE 2014 CS (CS3) – Question 46
Over $\Sigma=\{0,1,c\}$, let $L_1=\{0^n1^n:n\ge0\}$, $L_2=\{wcw^r:w\in\{0,1\}^*\}$, $L_3=\{ww^r:w\in\{0,1\}^*\}$, where $w^r$ reverses w. Which languages are deterministic context-free?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) Only L₁ and L₂
Explanation
A deterministic pushdown automaton recognises0ⁿ1ⁿby switching from push to pop at the first1. It also recognises wcw^Rbecause cexplicitly marks the midpoint. Inww^Rthere is no marker telling a deterministic machine when to switch. Hence **onlyL1andL2,C**.