2,222 views
1 votes
1 votes
Which of the following regular expression generates the set of all strings not containing ‘baa’ as a substring over input alphabet {a, b}?
(a) a*(b*a)* (b) a*b*ab
(c) a*baba* (d) a*(ba+b)*

i think an answer would be both B & D but an answer is given D

1 Answer

2 votes
2 votes

Your doubt is Genuin.

Both B and D options are not generating 'baa' as a Substring.

But if you observe carefully question says "Set of all strings".

That means the R.E. should also generate strings like epsilon,a,b,........

So, Option D fits the Best.

Hope You are Clear.

No related questions found