0

Is this possible to create with a finite state machine?

So like 101 is accepted because odd number of 0's but 1001 is rejected because even 0's

11 is not accepted because 0 is even.

etc etc.

fsdff
  • 611
  • 4
  • 10

1 Answers1

3

Yes and it's easy to do it with only two states representing even number of 0's and odd number of 0's respectively:

enter image description here

The accepted state is 2

Gerard Rozsavolgyi
  • 4,834
  • 4
  • 32
  • 39
  • Yes it works: you read 1 => State 1 then 011 => State 2 then 0 => State 1, 0 => State 2 and 01 => State 1. Your word is rejected because it has an even number of zeros. – Gerard Rozsavolgyi May 24 '17 at 09:32
  • Oh i'm sorry, I may haven't explained it well, it needs to have an odd number of zeroes so like 10110001 works because there is an odd number of zeroes incased in the first 1 and an odd number of zeroes incased in the second ones. – fsdff May 24 '17 at 16:16