416 views
1 votes
1 votes

find regular expression for  " set of all strings over {0,1} having at most one pair of 0's or at most one pair of 1's.

2 Answers

1 votes
1 votes

This question asking for at most one occurrence of 11 or at most one occurrence of 00.

so start with : 

 (∈+ 1 + 11) + (∈+0+00)

Now we have to build around it the combination of 1’s and 0’s that will prevent another occurrence of “11" or "00"

  So,Regular Expression should be =

(0+∈) (10)* (∈+ 1 + 11) (01)* (0+∈)+ (1+∈) (01)*(∈+0+00) (10)* (1+∈)

edited by
0 votes
0 votes
eps + 0 + 1 +( 01)* +( 10 )* + (01)* 00 (10)* + (10)*11(01)*