0

I have to do this exercise and am completely stumped as to how. I've constructed some FA's before, but using binary numbers. How can I do this but for even decimal numbers?

corsiKa
  • 81,495
  • 25
  • 153
  • 204
Tino
  • 91
  • 2
  • 8
  • How would you express it as a regular expression? – Oliver Charlesworth May 23 '12 at 00:19
  • (0-9)*(0|2|4|6|8) - I'm not very good with regex but that's what I think it should be (By the way I'm using formal notation for the regex). – Tino May 23 '12 at 00:28
  • Ok, so you should be able to draw a state diagram that corresponds to that regular expression. – Oliver Charlesworth May 23 '12 at 00:29
  • My question then is, can I represent each edge in the FA diagram with more than one number (ex. edge from first state to second state is "1,3,5,7,9")? – Tino May 23 '12 at 00:54
  • Putting multiple labels on an edge is really just a shorthand for each label having its own edge; if you were to implement the FA, you'd have to break them out, but its much easier to read w/ multiple labels. – Scott Hunter May 23 '12 at 01:13

1 Answers1

2

It would be a simple one.

2 states: q1, q2.

  • q1 is initial state.
  • q2 is final state.
  • if input digit on q1 is any even digit, make a move to q2.
  • if input digit on q1 is any odd digit, remain on q1.
  • if input digit on q2 is any even digit, remain on q2.
  • if input digit on q2 is any odd digit, make a move back to q1.
akaHuman
  • 1,332
  • 1
  • 14
  • 33