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}
Lab 2 ∑={0,1} L = {w : if |w| is odd w begins with 11}. List...
Lab 2 ∑={0,1} L = {w : if |w| is odd w begins with 11}. List the indistinguishability classes for L(M). Include the following information for each class c, where wc is a string in c: • A short description or characteristic function that describes the strings in c. • Whether wc is or is not in L(M). • ∀z(wcz ∈ L(M) iff … ). This rule must be different for each equivalence class — that is what makes them...
Create a DFA for L = {wwR|w ∈ {0, 1}∗}. WR represents the reverse of the...
Create a DFA for L = {wwR|w ∈ {0, 1}∗}. WR represents the reverse of the string. Explain your answer.
L= {w belongs to {0,1}* | the number of 0's is a prime number} . Prove...
L= {w belongs to {0,1}* | the number of 0's is a prime number} . Prove that the language L is not regular.
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.
Design a state machine to recognize if a binary string contains any occurrence of the sequence...
Design a state machine to recognize if a binary string contains any occurrence of the sequence “10101”. Is it possible to design this state machine with less states? By using Finite State machine designer. http://madebyevan.com/fsm/
Draw UML diagram Define a class named Document that contains a member variable of type string...
Draw UML diagram Define a class named Document that contains a member variable of type string named text that stores any textual content for the document. Create a function named getText that returns the text field and a way to set this value. Next, define a class for Email that is derived from Document and that includes member variables for the sender , recipient , and title of an e-mail message. Implement appropriate accessor and mutator functions. The body of...
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