Open In App

GATE | GATE-CS-2004 | Question 87

Like Article
Like
Save
Share
Report

The language {am bn Cm+n | m, n ≥ 1} is

(A)

regular

(B)

context-free but not regular

(C)

context sensitive but not context free

(D)

type-0 but not context sensitive



Answer: (B)

Explanation:

We construct a PDA for the given language. 

PUSH Z0 in the stack initially. 
PUSH X in the stack for each occurrence of ‘a’ . 
PUSH Y in the stack for each occurrence of ‘b’. 
POP X and Y from the stack for each occurrence of ‘c’.
 
If after popping all X and Y from the stack , no input element is left in the string and we get Z0 on the top of the stack then the string is accepted. 
 
Thus, option (B) is correct. 


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads