Question

In: Computer Science

- Give state diagram of DFA recognizing L={w | w is 0,1-string, and contains 3k 0s...

-



Give state diagram of DFA recognizing L={w | w is 0,1-string, and contains 3k 0s and 2m 1s for some integers k and m at least 0}. For examples, 0010111 is in L, but 010011 is not in L. The first string contains 3 0s and 4=2x2 1s, but the second string has an odd number of 1s.


Solutions

Expert Solution

DFA: In DFA, for each input symbol, one can determine the state to which the machine will move. Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is called Deterministic Finite Machine or Deterministic Finite Automaton.

When the string is passed to the DFA and ends on the final state, denoted by two circles, the string is accepted by L and when string ends in a non-final state the string is not accepted.

So when we move from q2 or q4 to left, we make it 3k+3 i.e. 3(k+1) hence mutliple of 3.

Similary when we move from top to down we increase the count of number of 1's by 1 and hence it becomes 2m+1 and when we go from down to top number of 1's increase by 1 resulting into 2m+2 i.e. 2(m+1) hence multiple of 2.

So, when we reach to q0, we have number of 1's in form of 2m and number 0's in form of 3k.

Let's see use the first exmaple given in question:

L1 = 0010111

Transition Character

Step 1: q0 -> q1 0

Step 2: q1 -> q2 0

Step 3: q2 -> q5 1

Step 4: q5 -> q3 0

Step 5: q3 -> q0 1

Step 6: q0 -> q3 1

Step 7: q3 -> q0 1

Since q0 is final state hence the string L1 i.e. 0010111 is accepted.

Now let's have a look at second example
L2 = 010011

Step 1: q0 -> q1 0

Step 2: q1 -> q4 1

Step 3: q4 -> q5 0

Step 4: q5 -> q3 0

Step 5: q3 -> q0 1

Step 6: q0 -> q3 1

Here the string ends on state q3, which is not the final state, hence this string will not be accepted and is not in the form of 'w' as mentioned in above.

Thank You and Have a good day,


Related Solutions

write the dfa for Let L={w in {0,1}*| w is a binary number that is a...
write the dfa for Let L={w in {0,1}*| w is a binary number that is a multiple of 4}
Draw an NFA for the following language then convert to a DFA: L = {w :...
Draw an NFA for the following language then convert to a DFA: L = {w : |w| is odd or |w| is a multiple of 4} where Σ = {0, 1}
1.True or False: a)If a language L is recognized by a 2^n-state DFA, then it must...
1.True or False: a)If a language L is recognized by a 2^n-state DFA, then it must be recognized by some NFA with no more than n states. b)For every three regular expressions R, S, and T, the languages denoted by R(S∪T) and (RS)∪(RT) are the same. Please explain.
Draw a state diagram of the string pattern recognizer, implement it according to the design sequence...
Draw a state diagram of the string pattern recognizer, implement it according to the design sequence of the FSM, and draw a schematic diagram.
can you please give me an example of a state diagram and a flow chart for...
can you please give me an example of a state diagram and a flow chart for a simple program?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT