623 views
0 votes
0 votes

1 Answer

0 votes
0 votes
$L = \{ x \in \left \{ a,b,c \right \}^* | \ \text{x is a palindrome} \}$

we can consider two languages,

$L_1 = \{ WW^R | \ W \in \left \{ a,b,c \right \}^* \}$

$L_2 = \{ WQW^R | \ W \in \left \{ a,b,c \right \}^* \text { and } Q \in \{ a, b, c \} \}$

$L_1 \cup L_2 = L$

$L_1$ is language consisting all even length palindromes

$L_2$ is a language consisting of all odd length palindromes

$CFL's$ are closed under union, so we need to show $L_1$ and $L_2$ are $CFL's.$

How to build PDA for $L_1$ and $L_2$?

for $L_1$ push a on seeing a, push b on seeing b and push c on seeing c, then when you reached half length of string then change the state and start popping the symbols.

But how to know when we reached half of the string?

Our NPDA will guess non-deterministically when we've read half of the symbols.

for $L_2$  we are gonna do same with just one small trick, when we've reached half of the string length we will encounter $Q$ which will be just one of the $\Sigma$, so on seeing $Q$ we need to change the state and with no change in stack. Then we've to pop symbols on seeing a pop a and so on.

This shows that $L$ is $CFL$.

Related questions

0 votes
0 votes
1 answer
1
himgta asked Oct 19, 2018
409 views
they have given b as the answer...i think answer is d....plz check!
0 votes
0 votes
0 answers
2
himgta asked Oct 19, 2018
122 views
0 votes
0 votes
1 answer
3
himgta asked Oct 19, 2018
355 views
2 votes
2 votes
0 answers
4
Prajwal Bhat asked Dec 27, 2016
986 views
A.11B.12C.13D.14Couldn't visualize how counter is assigned and how page is exactly replaced based on counter.Visual representation would be helpful rather than just ans!