3,672 views
0 votes
0 votes
Find the regular expression

No 2 a's and 2 b's should come together?

4 Answers

1 votes
1 votes

No two a's and b's should come together..so language is L=(Epsilon+b)(ab)* (a+Epsilon).

L={Epsilon, b, a, ab,abab,....,bab,babab,....aba,ababa,....}

0 votes
0 votes
(a+€) (ba) * (b+€) + a+b+ab+€

Explanation :

The only possible strings is a followed by b and b followed by a tht is  bababa.....  

So we get (ba) *

But strings could also start with a and could also end with b

So we add (€+a) and (b+€) at the start and the end

But the minimum possible string in our regular expression is ba which means we have left some strings

So we add ab+a+b+€ in the end to cover all possible strings
0 votes
0 votes
alphabets= { a , b }


L={ epsilon , a , b , ab , ba , aba , bab , abab ,...........................} it's infinite language
It may have these two answers
1)         (epsilon+b)(ab)*(epsilon+a)

or

2)         (epsilon+a)(ba)*(epsilon+b)


Both of them are correct

Related questions

1 votes
1 votes
1 answer
1
0 votes
0 votes
1 answer
2
hasina ali asked Mar 21
91 views
Set of binary strings starting with 11 and ending with 00. E.g., 1100,1110100 ,1100100
0 votes
0 votes
1 answer
3
utsav22222 asked Mar 15
132 views
Write regular expression for the set of strings of 0's and 1's with at most one pair of consecutive 1's.