DFSA, NFSA and Equivalence to Regular Expressions.
DFSA stands for Deterministic Finite State Automata:
After Regular Expressions ---> Danny moved to this topic.
DFSA is basically a machine with different states inside it, some of the states are accepting and some of them are non-accepting states. A DFSA represents the language defined by regex. So, basically all the strings belonging to the language are supposed to end up in accepting states when given to DFSA, all other strings will end up in dead or non-accepting States. Deterministic part of DFSA is what makes it distinct, because transition from one state to the other is purely determined by the Input and the current state.
NFSA :- Non -Determinsitic Finite State Automata.
if a DFSA exist for a regular Expression then a NFSA also exsists.
In NFSA State Transitions are non-deterministic, from one state we can have path to two different states for the same input. It is completely dependent on the machine which state it chooses to go to.
Same Way we can have epsilon transitions in NFSA.
The Idea of NFSA is difficult to grasp in he begining, but then as I worked through examples from course notes and Tutorials... the idea becomes clear... Eventually making NFSA is eaiser then DFSA.
The Idea of NFSA is difficult to grasp in he begining, but then as I worked through examples from course notes and Tutorials... the idea becomes clear... Eventually making NFSA is eaiser then DFSA.
Now, the Third paart of This Post...
For Every DFSA or NFSA there is an Regular Expression.
For Every DFSA or NFSA there is an Regular Expression.
Assume that you have Implemented a DFSA...
You have the State Transition Diagram Let's Say with 3 states...
You have the State Transition Diagram Let's Say with 3 states...
To find the equivalent regex.
We need to eliminate all the states between Initial state to accepting state.
We need to eliminate all the states between Initial state to accepting state.
Eliminating states can be delicate as you have to preserve the state transitions of eliminated state.
After State Elimination we will be left with two states, Initial and accpeting state,
From the resulting Diagram we can figure out the Regex.
This requires practice... Nothing is abstract about it!
After State Elimination we will be left with two states, Initial and accpeting state,
From the resulting Diagram we can figure out the Regex.
This requires practice... Nothing is abstract about it!
Practice from course notes and online refrences from google is also a good option.
No comments:
Post a Comment