reshown by
691 views
0 votes
0 votes
What will be the regular expression for the language consisting of all binary strings which have at most one pair of consecutive zeroes?
reshown by

1 Answer

Best answer
5 votes
5 votes

Break it down into : "Exactly One Pair of Consecutive Zeroes" $+$ "NO pair of Consecutive zeroes"

Now,  

"Exactly One Pair of Consecutive Zeroes" =  $(1 + 01)^* \,00  (1+10)^*$

"NO pair of Consecutive zeroes" =  $(1 + 01)^*(0 + \in) $

So, Now combine these Two and We will have :

 The regular expression for the language consisting of all binary strings which have at most one pair of consecutive zeroes :

 $(1 + 01)^* \,00  (1+10)^*$  $+$   $(1 + 01)^*(0 + \in) $


(You could take  $(1 + 01)^*$ common and simplify further But for understanding purpose, let it be the way it is)

selected by

Related questions

0 votes
0 votes
0 answers
2