- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

A Deterministic Finite automaton (DFA) is a 5-tuples

**M=(Q, Σ, δ,q0,F)**

Where,

- Q : Finite set called states.
- Σ : Finite set called alphabets.
- δ : Q × Σ → Q is the transition function.
- q0 ϵ Q is the start or initial state.
- F : Final or accept state.

Construct DFA of a string with at least two 0’s and at least two 1’s.

The language generated based on the given condition over the alphabet Σ ={0,1) is −

L={0011,001011,0001010,0011001,010101,……}

The given language accepts at least two zero’s means it can accept two or more than two zero’s and at least two one’s means it accepts two or more than two one’s.

Suppose,

**Input**− 00010**Output**− string rejected

Because, the given input does not have at least two’s.

Even though it has at least zeros, it won’t accept the string.

To accept the string both conditions are satisfied, if one fails the string will not be accepted by the machine.

- Input − 001001001
- Output − string accepted

Now construct the DFA for given inputs −

State | Number of zero’s | Number of one's |
---|---|---|

→ q0 | 0 | 0 |

q1 | 0 | 1 |

q2 | 0 | > =2 |

q3 | 1 | 0 |

q4 | 1 | 1 |

q5 | 1 | > =2 |

q6 | > =2 | 0 |

q7 | > =2 | 1 |

*q8 | > =2 | > =2 |

The DFA will be as follows −

If input is 1 then the number of 1 increases to 1. Move to state q1. If input is 0 then the number of 0 increases to 1. Move to state q3.

If input is 1 then the number of 1 increases to 2. Move to state q2. If input is 0 then the number of 0 increases to 1. Move to state q4.

If input is 1 then the number of 1 always increases by 1. And then remain in the same state. If input is 0 then the number of 0 increases to 1. Move to state q5.

If input is 1 then the number of 1 increases to 1. Move to state q4. If input is 0 then the number of 0 increases to 2. Move to state q6.

If input is 1 then the number of 1 increases to 2. Move to state q5. If input is 0 then number of 0 increases to 2. Move to state q7.

If input is 1 then the number of 1 always increases by 1. And then remain in the same state. If input is 0 then the number of 0 increases to 2. Move to state q8

If input is 1 then the number of 1 increase to 1. Move to state q7. If input is 0 then the number of 0 keeps increasing by 1. And then remain in the same state.

If input is 1 then the number of 1 increase to 2. Move to state q8. If input is 0 then the number of 0 keeps increasing by 1. And then remain in the same state.

If input is 1 then the number of 1 always increases by 1. And then remain in the same state. If input is 0 then the number of 0 keeps increasing by 1. And then remain in the same state.

Finally, if the string is finished, then it is ACCEPTED.

- Related Questions & Answers
- Construct DFA of alternate 0’s and 1’s
- Design a DFA machine accepting odd numbers of 0’s or even numbers of 1’s
- Match any string containing a sequence of at least two p's.
- Design NFA with Σ = {0, 1} and accept all string of length at least 2.
- Design DFA for language over {0,1} accepting strings with odd number of 1’s and even number of 0’s
- Sort an arrays of 0’s, 1’s and 2’s using C++
- Sort an arrays of 0’s, 1’s and 2’s using Java
- Maximum 0’s between two immediate 1’s in binary representation in C++
- Explain the intersection process of two DFA’s
- Count subarrays with equal number of 1’s and 0’s in C++
- Maximum length of segments of 0’s and 1’s in C++
- Design Turing Machine to reverse string consisting of a’s and b’s
- Design a TM for equal number of a’s and b’s
- Two’s Complement
- 1’s and 2’s complement of a Binary Number?

Advertisements