4

What would be a regular expression for the language of words containing a single 1 and an even number of 0s?

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
user97862
  • 41
  • 1

1 Answers1

3

If a word contains exactly one 1 and an even number of zeroes, then we can decompose it in one of two different ways:

  1. An even number of 0s, followed by 1, followed by an even number of 0s.
  2. An odd number of 0s, followed by 1, followed by an odd number of 0s.

You take it from here.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503