The language L= {0i21i | i≥0 } over the alphabet {0,1, 2} is:
(A) not recursive
(B) is recursive and is a deterministic CFL.
(C) is a regular language.
(D) is not a deterministic CFL but a CFL.
Answer: (B)
Explanation: Let us first design a deterministic pushdown automata for the given language.
- For each occurrence of ‘0’ , we PUSH X in the stack.
- When ‘2’ appears, no stack operation is performed. But, state of the automata is changed.
- For each occurrence of ‘1’ , we POP X from the stack.
- If at the end Z0 is on the stack top then input string is accepted
We also design a Turing machine for the given language.
- When ‘0’ appears in the input string , we replace it with X .Then, traverse to the rightmost corner and replace ‘1’ with Y.
- We go back to the leftmost ‘0’ and repeat the above process.
- While traversing rightwards from the beginning of the input string, if after X, ‘2’ appears and after ‘2’, Y appears then we reach the HALT state.
Thus, the given language is recursive. Every recursive language is a CFL.
Thus, option (B) is the answer.
Please comment below if you find anything wrong in the above post.
Quiz of this Question
Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing
Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.
Last Updated :
28 Jun, 2021
Like Article
Save Article