562 views

1 Answer

1 votes
1 votes

$Regular$ $Expression$ : $1^* (01^+)^*  00 (1^+ 0)^* 1^* $

  • $1^*$: Your expression could start with any number of 1’s since there is no restriction on the number of 1’s. Since it is $1^*$, you can also start your Expression with 0 by taking $1^*$ as Epsilon(∊)
  • $(01^+)^*$: If you find a $0$ then it should be followed by at least ‘one’ $1$ since you don’t want consecutive $0’s$
  • $00$ : The one pair of consecutive $0’s$ you were looking for
  • $(1^+0)^*$ : After you find the 00 you were looking for you cannot have another $0$ following it since then you’ll have a substring $000$ which equates to 2 consecutive $0’s$. So a 00 is always followed by at least ‘one’ $1$. After the $1$, if you encounter another 0 then that 0 again has to be followed by at least ‘one’ $1$. So , you will have a loop here of $(1^+ 0)$ again and again and hence we add star to $(1^+0)^*$ 
  • $1^*$: Notice that if you end your $Regular$ $Expression$ with $(1^+ 0)^*$ , every one of your strings will end with 0 . So with $1^*$ at the end it can also produce all the strings in $L$ ending with 1

 

Related questions

1 votes
1 votes
1 answer
1
Naveen Kumar 3 asked Mar 31, 2019
1,851 views
Find regular expressions for the following languages on {$a, b$}.(a) $L =$ {$w : |w|$ mod $3 = 0$}.(b) $L =$ {$w : n_a (w)$ mod $3 = 0$}.(c) $L =$ {$w : n_a (w)$ mod $5 ...