# GATE | GATE 2017 MOCK II | Question 41

The language L = {WbcWR | W ∈ (a+b)*} is _____.
(A) DCFL
(B) CFL but not DCFL
(C) Non-CFL
(D) None of the above

Explanation: Any language for which we can have a Deterministic PDA is always a DCFL.
Here for language L= {WbcWR | W ∈ (a+b)*} we can have a PDA with following transitions in which PDA accepts a string when it halts on a final state. q0 in initial state and qf is final state.

1. (q0, a , Z) -> (q0, aZ)

2. (q0, b , Z) -> (q0, bZ)

3. (q0, a , a) ->(q0, aa)

4. (q0, b , a) -> (q0, ba)

5. (q0, a, b) -> (q0, ab)

6. (q0, b , b) -> (q0, bb)

7. (q0, c , b) -> (q1, null)

8. (q1, a , a) ->(q1, null)

9. (q1, b , b) -> (q1, null)

10. (q1, null, Z ) -> (qf, Z)

Here all a’s and b’s are initially pushed onto the stack for W. As soon as a c occurs after b , B is popped from the stack after which W^R is checked. If the further string alphabets match the
alphabet of the stack the alphabet is popped from the stack and finally the string reaches the final state if language is of the form L= {WbcW^R | W ∈ (a+b)*}.

Hence the above language is a DCFL.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.