honestly im stuck Find a regular expression that defines the

honestly im stuck!

Find a regular expression that defines the language consisting of all words of 0\'s and 1\'s with an odd number of 1\'s.

Solution

or

The even length example gives you a valuable clue. Repeat a pattern with 2 of what\'s needed to get an even number. Tack on one more of that pattern to make the count odd.
Odd number of a\'s: 0*1(0*10*1)*0*

The pattern 0*1 is used three time. That\'s any number of 0\'s, followed by a single 1.

The parenthesized expression has that unit twice, matching any number with exactly two a\'s that ends with an 1.

Repeat that to match every number with an even number of 1\'s that ends with an a.

Finally, tack on one more 0*1 to make the number of 1\'s odd, and a trailing 0* to allow for trailing 0\'s.

or

honestly im stuck! Find a regular expression that defines the language consisting of all words of 0\'s and 1\'s with an odd number of 1\'s.Solutionor The even l

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site