Skip to content
Related Articles
Open in App
Not now

Related Articles

ISRO | ISRO CS 2017 | Question 26

Improve Article
Save Article
  • Last Updated : 14 Dec, 2021
Improve Article
Save Article

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 automata 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
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!