5 votes 5 votes Which of the following are context-free? $A=\{a^n b^n\, a^mb^m\mid m,n\geq0\}$ $B=\{a^m b^n\, a^mb^n\mid m,n\geq0\}$ $C=\{a^mb^n\mid m\neq 2n,\,m,n\geq0\}$ A and B only A and C only B and C only C only Theory of Computation isrodec2017 + – gatecse asked Dec 17, 2017 • recategorized Feb 11, 2018 by srestha gatecse 1.2k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 6 votes 6 votes A is context free : push a′s into stack, for each b's pop the stack. If stack is empty, then string is accepted B is NOT context free. Single stack is not sufficient because m and n are not comparable we cannot find when to push or pop; But this is CSL. C is context free : push a′s into stack, for each b's pop the stack two times. If stack is empty, then string is NOT accepted Answer is B ) A and C Only sh!va answered Jan 11, 2018 • selected Feb 12, 2018 by Prashant. sh!va comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes A and C only option B: a's cannot be compared using stack as b's will be above it. Manoja Rajalakshmi A answered Dec 21, 2017 Manoja Rajalakshmi A comment Share Follow See all 0 reply Please log in or register to add a comment.