1,076 views
1 votes
1 votes

Which of the following is CSL?

3 Answers

2 votes
2 votes

All of them are Context Sensitive.

Option A , For one 0 donot push anything to stack and then for all 0 push it into the stack , same with 1 , for 1st 1 donot do anything and from rest start pushing it into stack , and for every zero now pop out 0 and 1.

here we require 2 stacks for storing the info of first 0 and 1 , and one more stack for comparing , so it is CSL.

Option B , for all 0 push them into stack , and for 1 push them into stack and pop out 0 after all 0 are poped out push 1's. Now to push 0 we require here comparision with m , but we have poped them out , so we would need atleast 3 stack.

Option C again we need 3 stacks at min.

so all are CSL , let me know if i am wrong.

edited by
0 votes
0 votes
I think the ans is B

A.

for the first 0 dont push any stack symbol, start pushing 0 after that. similarly for the first 1 dont push any stack symbol , start pushing one 1 after that. Now simply pop the stack for every 0 . Thus its a CFL

C.  is recursive as for every m+n there should exist a point in grammer which can identify m which is to be used by 0 at last. I AM NOT SURE OF THIS.

B. we know that 0^n 1^n 0^n  is CSL we just need to add a production which produces any number of ones in addition to n number of 1s therefore producing m+n 1s.

Therefore I think B is a CSL
0 votes
0 votes
If this is standard question then we must find the language which is CSL and Not CFl because we look for most restrictive case.

option A: push 0 then do nothing on last 0 , now push 1 and do nothing on last 1,now pop 1 from 0 until we get 0 on top of stack then again pop 0 by looking 0 on top of stack until we get empty stack. so it is CFL since it is accepted by single stack.

option C : push 0 then pop 0 by looking 1 until we get empty stack and then do nothing on looking last 0^m. so accepted again by single stack.

Option B : push 0 then pop 0 by looking 0 until we get empty stack (for first half 0^m 1^m)....but now there is no way to count last 0^m in this stack because we have already popped off all elements from stack. thus it can not be accepted by single stack .....Not CFL and it can be accepted by two stacks because two comparisons are required ..thus it is CSL.

Option B is correct

Related questions

1 votes
1 votes
2 answers
1
amrish0524 asked Nov 14, 2023
282 views
Which of the following Language has Prefix property?A) L=01*B) L=0*1*c) L= {0" 1" | n>, 1}D) L= {WW | We(0+1)*}
1 votes
1 votes
0 answers
3
Vivo asked Oct 5, 2021
260 views
identify options for which operation CFL's are not closed?a)union, complementb)complement, intersection
0 votes
0 votes
1 answer
4
Vivo asked Oct 5, 2021
342 views
number of 3 state dfa with designated initial stat can be constructed over the alphabet {0,1,2} with exactly 2 final states is a)3^8b)3^9c)3^10d)3^11