Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

ISRO | ISRO CS 2017 | Question 26

  • Last Updated : 13 May, 2020

Which of the following are context free?

A = {anbnambm | m, n>=0}
B = {ambnambn | m, n>=0}
C = {ambn | m≠2n,m, n>=0}

(A) A and B only
(B) A and C only
(C) B and C only
(D) C only


Answer: (B)

Explanation: First check for A :-
a^n & b^n and a^m & b^m must be comparable using one stack for CFL. Push all a^n into the stack then pop all b^n for each a^n if at the buttom of the having null the a and b both are equal similarly compare a^m and b^m can be compare as push a^m into the stack and pop b^m for each a^m , therefore it is context free language.

For B:-
This can not be done in to a single stack because m and n are not comparable we can not find when to push or when to pop so we need here more stack that’s why this is Context sensitive language.

For C:-
It is also Context free language because first make the autoamata for the language a^m b^n| m=2n then make final state as non final state and non final as final.

Option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :