edited by
927 views
5 votes
5 votes

Consider the languages

(I) L1= {w#x , where w,x ∈ (0+1)* and # is a special character and w is a prefix of x } .
(II) L2={w#x , where w,x ∈ (0+1)* and # is a special character and wR, is a prefix of x}.
(III) L3={w#x , where w,x ∈ (0+1)* and # is a special character and wR, is a substring of x}
(IV) L4={w#x , where w,x ∈ (0+1)* and # is a special character and wR, is suffix of x}

  1.  (I) is recursive and (II), (III) and (IV) are DCFL.
  2.   (I) is CFL but not DCFL , (II) and (III) is DCFL, (IV) is recursive but not CFL.
  3.   (II) and (III) is DCFL (I) and (IV) is recursive but not CFL.
  4.   (I) is recursive , (II) is DCFL , (III) and (IV) are CFL but not DCFL
edited by

1 Answer

Best answer
6 votes
6 votes

Let us analyse one by one : 

i) For L1 , if w needs to be the prefix of x , then this is similar to : w # w p where p is the part other than the prefix which is 'w' in this case for the string part 'x' . So now this is nothing but comparision of w with w as we have # in between and # is a single symbol only so comparision of w with w is needed . And we know this is not achievable using single stack . Hence L1 is not a CFL but a CSL and hence recursive .

ii) For L2 , most of the thing is same except the fact that now we will have : w # wR p .Hence now it is possible to implement with a single and that too with determinism i.e. we know when to push or pop as well how much to push or pop from the stack . The contents of 'w' are pushed to stack and when '#' comes we do just state transition as an indication that from next input symbol onwards which belongs to 'wR' , the contents of 'w' will be popped as well . And the 'p' part can be anything(regular part) , hence need not to be worried . Hence L2 is DCFL .

iv) For L4 , we will have string of the form :  w # p wR  . Now again since '#' is a symbol only , hence we have to take care of the 'w' as well as 'wR' and hence we cannot ignore them here as well by substituting epsilon in place of 'w' and 'wR' which would be a wrong substitution here . So we need to see the content of w as well as wR . Now the thing is we do not know when the 'p' part would end and 'wR' part would start so that we can pop the contents of w which is in stack currently . Hence it has non deterministic behaviour . Hence L4 is CFL but not DCFL . 

iii) For L3 , we need to check whether wR is substring of 'x' in the similar manner like we checked for prefix and suffix in earlier cases . Here we will have string of the form : w # p wR q  as wR can be anywhere in middle in the 'x' part or can be its suffix or prefix . Now this problem becomes similar to L3 as we do not know when 'p' would end and wR part would come .Hence L3 is a CFL but not DCFL.

Hence D) should be the correct option .

selected by

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
1 answer
2
Souvik33 asked Dec 4, 2022
346 views
Consider the following statementS: $\left \{ a^{n}b^{n+k}|n\geq 0,k\geq 1 \right \} \cup \left \{a^{n+k}b^{n}|n\geq 0,k\geq 3 \right \}$ is DCFLThe above statement is:TRU...
2 votes
2 votes
1 answer
3
Souvik33 asked Nov 23, 2022
313 views
If L and $L^{c}$ both are CFL, the L must be DCFL a. TRUE b.FALSE
1 votes
1 votes
2 answers
4
atulcse asked Jan 21, 2022
716 views
Is the following language a DCFL? Please explain your reasoning.