in Theory of Computation edited by
337 views
0 votes
0 votes

i thought that it is the language where both start and end symbols are same and i got 65 but the ans is 29

in Theory of Computation edited by
337 views

2 Answers

0 votes
0 votes
Best answer
The language generated by the grammar is : $w(a+b+\varepsilon)w^{r}, |w|>=0, w\,\epsilon\,(a,b)$

For $0\,and\,1$ length string : $|w|=0$, strings = $a,b,\varepsilon$

For $2$ length strings, the strings are : $w(\varepsilon)w^{r}, |w|=1$

For $3$ length strings, the strings are : $w(a+b)w^{r}, |w|=1$

For $4$ length strings, the strings are : $w(\varepsilon)w^{r}, |w|=2$

For $5$ length strings, the strings are : $w(a+b)w^{r}, |w|=2$

For $6$ length strings, the strings are : $w(a+b)w^{r}, |w|=3$

Total = $3+2^{1}+2^{1}*2+2^{2}+2^{2}*2+2^{3}=29$
selected by
0 votes
0 votes

ans- is 29 only, see all derivation tree