-1

i want to design a DFA of an alphabet {x,y,z} which accepts words with a number of 'z' multiples of 3 (eg "xzyyxzzyy")

Does anybody knows how? or which is the language that accepts it?

goofy126
  • 13
  • 2

1 Answers1

0

You will need three states to keep track of the number of z's seen, modulo three; the states will cycle through each other on input z, and the one for #z(w) = 0 (mod 3) will be the only accepting state.

To allow any arbitrary x's and y's, each state can loop to itself on these inputs.

You might use q0, q1 and q2 for the states, making q0 the initial state and only accepting state. Then, you have three transitions f(qi, z) = wh where j = i + 1 (mod 3), three transitions f(q, x) = q and three transitions f(q, y) = q for a total of nine transitions.

Patrick87
  • 27,682
  • 3
  • 38
  • 73