What is the regular expression for the language 0m1n where m+n is even?
If you mean a string 000...111...
where the length of the string is even, you can use ^(00)*(01)?(11)*$
Ok, so you need to consider for zero the cases when there are odd and when they are even. This requires two states, one for even zeros, one for odd zeros. Then for the odd zero case you need to have 1 one then an even number of ones. For the even case you just need an even number of ones.
Its easy to write the DFA, but I don't know how to plot it here, so I'm going to hazard a guess at the regular expression:
(0 (00)* 1 (11)*) \/ (00)*(11)*
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