regular expression for bit strings with even number of 1s

Posted by equilibrium on Stack Overflow See other posts from Stack Overflow or by equilibrium
Published on 2010-04-24T05:18:10Z Indexed on 2010/04/24 5:23 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

Let L= { w in (0+1)* | w has even number of 1s}, i.e. L is the set of all bit strings with even number of 1s. Which one of the regular expressions below represents L?

A) (0*10*1)*
B) 0*(10*10*)*
C) 0*(10*1)* 0*
D) 0*1(10*1)* 10*

According to me option D is never correct because it does not represent the bit string with zero 1s. But what about the other options? We are concerned about the number of 1s(even or not) not the number of zeros doesn't matter.

Then which is the correct option and why?

© Stack Overflow or respective owner

Related posts about homework

Related posts about grammar