- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Give an example problem of converting NFA to DFA.
Problem
Consider a Non-deterministic finite automata (NFA) and convert that NFA into equivalent Deterministic Finite Automata (DFA).
Solution
Let’s construct NFA transition table for the given diagram −
States\inputs | a | b |
---|---|---|
->q0 | {q0,q1} | q0 |
q1 | q2 | q1 |
q2 | q3 | q3 |
q3 | - | q2 |
DFA cannot have multiple states. So, consider {q0,q1} as a single state while constructing DFA.
Let’s convert the above table into equivalent DFA
States\inputs | a | b |
---|---|---|
->q1 | [q0,q1] | q0 |
[q0,q1] | [q0q1q2] | [q0q1] |
*[q0q1q2] | [q0q1q2q3] | [q0q1q3] |
*[q0q1q2q3] | [q0q1q2q3] | [q0q1q2q3] |
*[q0q1q3] | [q0q1q2] | [q0q1q2] |
In DFA the final states are q2 and q3, wherever q2 and q3 are present that state becomes a final state.
Now the transition diagram for DFA is as follows −
Advertisements