Question

Which of the CFL can generate exactly the following language {w: w=w^R}, the alphabet is {0,...

Which of the CFL can generate exactly the following language {w: w=w^R}, the alphabet is {0, 1}. (there may be more than one correct answer)

A. S -> 0S0 | 1S1 | 0 | 1

B. S -> T

T-> 0T0 | 1T1 | 0 | 1 | ɛ

C. S -> 0S0 | 1S1 | 0 | 1 | ɛ

D. S -> 0T0 | 1T1 | ɛ

T-> 0T0 | 1T1 | 0 | 1 | ɛ

0 0
Add a comment Improve this question Transcribed image text
Answer #1

.Here all the four CFL can genrate language \small w: w=w^R over alphabet {0,1}

Let us have a look at them one by one

A) S -> 0S0 | 1S1 | 0 | 1

lets generate few string using grammar

strings of length one

0,1

there is no string of length two

strings of length three

000,111,010,101

Now we can infer that language will be ={0,1,000,111,010,101............}

here we can observe that all the strings that will be generated by this CFL will be of odd length and all satisfy \small w: w=w^R .

B)

S -> T

T-> 0T0 | 1T1 | 0 | 1 | ɛ

let's generate few string using grammar

strings of length one

0,1

strings of length two

00,11

strings of length three

000,111,010,101

strings of length of four

0000,1111,0110,1001

Now we can infer that language will be ={\small \varepsilon,0,1,00,11,000,111,010,101,0000,1111,0110,1001............}

here we can observe that all the strings of length even and odd that can be generated by this CFL satisfy \small w: w=w^R .

C) This case is same as B , logically there is no difference between B option and C option,B can also be written as C and will produce same result.

D) S -> 0T0 | 1T1 | ɛ

T-> 0T0 | 1T1 | 0 | 1 |

let's generate few string using grammar

there is no string of length one generated by this CFL

strings of length two

00,11

strings of length three

000,111,010,101

strings of length of four

0000,1111,0110,1001

Now we can infer that language will be ={\small \varepsilon,00,11,000,111,010,101,0000,1111,0110,1001............}

here also we can observe that all the strings of length even and odd that can be generated by this CFL satisfy \small w: w=w^R .

note :- feel free to ask doubts in comments :)

Add a comment
Know the answer?
Add Answer to:
Which of the CFL can generate exactly the following language {w: w=w^R}, the alphabet is {0,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT