質問

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

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

You might find it fun to think of the solution.

役に立ちましたか?

解決 2

This is possible using a DFA simply have a state for each of the combinations of an odd number of a's, b's and c's. So if you're in the state with even # of a's, odd # of b's and an even # of c's then you can accept. You can also define simple transitions for any of the other cases. So naively this can be done with 8 states.

他のヒント

The way I would go about constructing such a machine is as follows. Make eight states. Each state represents a possible 3 tuple combination. The start state is a state representing the combination where all three are even. If a is the first character in the input, then you would to a state that represents an odd number of a's and even number of b's and c's. The accept state is where a and c are even, and b is odd.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top