in Theory of Computation edited by
9,784 views
32 votes
32 votes

Consider the following languages over the alphabet $\sum = \{0, 1, c\}$

$L_1  = \left\{0^n1^n\mid n \geq 0\right\}$

$L_2 = \left\{wcw^r \mid w \in \{0,1\}^*\right\}$

$L_3 = \left\{ww^r \mid w \in \{0,1\}^*\right\}$

Here, $w^r$ is the reverse of the string $w$. Which of these languages are deterministic Context-free languages?

  1. None of the languages
  2. Only $L_1$
  3. Only $L_1$ and $L_2$
  4. All the three languages
in Theory of Computation edited by
9.8k views

2 Comments

L3 is Non deterministic CFL ...

0
0
$L_{1} = \{0^n1^n\;|\;n\geq 0\}$
$00001111$ in this i/p string DPDA will push $0’s$ then after seeing $1’s$ will start to pop. Hence this DCFL.

$L_{2}=\{wcw^r\;|\;w\in \{0,1\}^*\}$
$0101c1010$ in this i/p string DPDA will start pushing $0101$ then seeing $c$ skip and now start poping while matching. Hence this is DCFL.

$L_{3}=\{ww^r\;|\;w\in \{0,1\}^*\}$
$01011010$ here DCFL don’t know where to pop or push. But PDA can do this with non-determinism. So this is CFL but not DCFL.
0
0

2 Answers

44 votes
44 votes
Best answer

Correct Option: C.

$L_3$  is CFL and not DCFL as in no way we can deterministically determine the MIDDLE point of the input string. 

edited by

4 Comments

Should not the answer be B? Because c belongs to the input alphabet.
0
0

As c belongs to the input alphabet, it is used to determine the middle part of the string.
for example 110c011 is in the language L2. every element is pushed to the stack untill a c occurs. Then the pda changes state and the popping starts.

0
0
Oh yea. Sorry. I mistook c to be a part of w as well.
0
0
If your push and pop is clear then it  is deterministic context free language otherwise not.
2
2
2 votes
2 votes

For the languages L& L  we can have deterministic push down automata, so they are
DCFL’s, but for L3 only non-deterministic PDA possible. So the language L3 is not a
deterministic CFL.

Answer:

Related questions