I have a simple question about finding a regular expression for a given language.
I am given the language L where:
L = {w ∈ {0, 1}* : w has exactly one pair of consecutive zeros}
My first attempt at this was to try L( (0 + 1)* 00 (0 + 1)*), but I noticed the problem with that would be with where I have (0 + 1)* because if 0 is chosen, it can be zero more more of them, thus leading to more than one pair of consecutive zeros.
I also know, that the possible cases I have are, two zeros in the front, in the middle, and at the end. I just am not quite sure how to create a regular expression for that.
Any help is much appreciated.
Try this:
1* (011*)* 00 (11*0)* 1*
An explanation:
The best possible answer for this problem is (1 + 01)* 00 (1 + 10)*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With