174k views
4 votes
Construct DFAs for the following languages:

1. The set of all binary strings beginning with 010 and ending with 101 .
(Note that the string 0101 should be accepted.)
2. The set of strings over {0,1} which do not contain 0110 as substring.
3. The set of strings over {a,b} such that the fourth symbol from the right is a
4. The set of all strings w₁...wₙ, n≥0, over {0,1,2,3,4} such that w₁+⋯+wₙ ≡ 0(mod5)
5. The set of binary strings containing at least two 1s and at most three 0s.

User Sleath
by
7.7k points

1 Answer

2 votes

Final answer:

For the first language, the DFA can have three states: A, B, and C. The second language can be represented by four states: A, B, C, and D. The third language can be represented by four states: A, B, C, and D.

Step-by-step explanation:

1. The set of all binary strings beginning with 010 and ending with 101:

To construct a DFA for this language, we can break it down into three states: State A for strings starting with 0, State B for strings starting with 01, and State C for strings starting with 010. From State C, we transition to our final accepting state when we encounter 101. The DFA will have a loop back to State A when any other digit is encountered.

2. The set of strings over {0,1} which do not contain 0110 as substring:

To construct a DFA for this language, you can start with a state A and transition to state B if you encounter a 0. If you encounter a 1, transition to state C. From state B, transition back to A if you encounter a 1. From state C, transition to D if you encounter a 0. In state D, you will transition back to C if you encounter a 1.

3. The set of strings over {a,b} such that the fourth symbol from the right is a:

You can construct a DFA for this language by starting with a state A and transitioning to state B when you encounter the first symbol from the right (either a or b). From state B, transition to C if the second symbol from the right is a, and transition to D if it is b. In state C, you transition back to B if the third symbol from the right is b, and vice versa in state D

User Mark Omo
by
7.0k points