World's most popular travel blog for travel bloggers.

[Solved]: Does this DFA have a solution?

, , No Comments
Problem Detail: 

I am trying to create a DFA that can recognize strings with alphabet $\{a,b,c\}$ where $a$ and $c$ appear even number of times and where $b$ appears odd number of times.

I am wondering that this may only be expressed with other methods such as Turing machine or context-free languages.

You might find it fun to think of the solution.

Asked By : NeilPeart

Answered By : usul

This is doable with a DFA. Hint: We need to keep track of three things simulataneously:

  1. The parity of a's (have we seen an odd or even number of a's so far?)
  2. The parity of b's
  3. The parity of c's

So there are 8 possibilities for what we've seen so far:

  1. Even number of a's, even number of b's, even number of c's.
  2. Odd number of a's, even number of b's, even number of c's.
  3. Even number of a's, odd number of b's, even number of c's.
  4. ...

Does that help?

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/7429

0 comments:

Post a Comment

Let us know your responses and feedback