0 votes 0 votes Ami Ladani asked Jan 14, 2017 Ami Ladani 785 views answer comment Share Follow See all 19 Comments See all 19 19 Comments reply saurabh rai commented Jan 14, 2017 reply Follow Share B is ans? 0 votes 0 votes Nithish commented Jan 14, 2017 reply Follow Share how do you say so? 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share ^bcoz it is nt cfl as i m thinking what urs 0 votes 0 votes Nithish commented Jan 14, 2017 reply Follow Share A &C are also not cfl right? 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share A nd C r cfl 0 votes 0 votes Nithish commented Jan 14, 2017 reply Follow Share I got how A will be CFL but how can C be CFL? First we can insert 0s and pop 1s then we have traverde over m 0s, but now, we donot have any facility to check m value right? Please correct me if I am wrong. 0 votes 0 votes sudsho commented Jan 14, 2017 reply Follow Share ^ how A is CFL? 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share @sudsho first we push all os so we have m+1 zero in stack now for first time 1 pop a zero so we have now m os on stack nd n 1s in i/p string now push all 1 so we have m+n 0 nd 1 on stack now for all next 0s in i/p pop all 0 nd 1s of stack nd now it is empty stack. 1 votes 1 votes Nithish commented Jan 14, 2017 reply Follow Share $0^{m+1} 1^{n+1} 0^{n+m}$ We can push 0s into stack and when we encounter 1 we have to pop one 0 and push 1s onto the stack. Now when we encounter 0, pop one 1 and then pop the top of the stack for each 0 encountered, if stack is empty and if there is no input character left, then we can accept the string else reject it. OR push 0s and 1s ,then pop the top of the stack for each 0 encountered, if the stack is left with 2 0s then we can accept the string else reject it. 1 votes 1 votes sudsho commented Jan 14, 2017 reply Follow Share yes..is c also CFL @saurabh? 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share for C assume m=1 forever.... 0 votes 0 votes Nithish commented Jan 14, 2017 reply Follow Share we don't have anything to compare value of m right? 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share yes it is cfl so i think B is Csl 0 votes 0 votes sudsho commented Jan 14, 2017 reply Follow Share @saurabh how will 00011100 be accepted then? 1 votes 1 votes vijaycs commented Jan 14, 2017 reply Follow Share B and C - CSL. A - CFL. 1 votes 1 votes sudsho commented Jan 14, 2017 reply Follow Share yes..c option is nt CFL...we cant fix m as 1 else after 1 we cant have more than one 0..which shouldnt be the case here we can only match (m+n)0s for (m+n) 1s..after this nothing will remain on the stack to compare with m 0s...its CSL.. 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share srry u r right... my mistake... 1 votes 1 votes Nithish commented Jan 14, 2017 reply Follow Share So, may be the options are wrong?! 0 votes 0 votes saurabh rai commented Jan 14, 2017 reply Follow Share ^agree with vijay.... 0 votes 0 votes Please log in or register to add a comment.