The Gateway to Computer Science Excellence
+22 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 by Veteran (106k points)
edited by | 1.8k views

L3 is Non deterministic CFL ...

3 Answers

+32 votes
Best answer


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

by Boss (19.9k points)
edited by
Should not the answer be B? Because c belongs to the input alphabet.

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.

Oh yea. Sorry. I mistook c to be a part of w as well.
If your push and pop is clear then it  is deterministic context free language otherwise not.
+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.

by Active (1.9k points)
0 votes
L1 and L2 are deterministic CFL, as we can design DPDA for them.

But in L3, we cannot make DPDA for it, as we cannot locate the middle of the string, so DPDA for L3 is not possible. It can be accepted by only NPDA, so L3 is CFL but not DCFL.
by Junior (577 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,833 questions
57,713 answers
107,711 users