logo

DFA SIMULATION USING C++ Deterministic Finite Automation

   

Added on  2023-04-25

4 Pages424 Words447 Views
 | 
 | 
 | 
Runninghead: DFA SIMULATION USING C++
DFA SIMULATION USING C++
Name of the Student:
Name of the University:
Author Note:
DFA SIMULATION USING C++ Deterministic Finite Automation_1

1DFA SIMULATION USING C++
Deterministic Finite Automation or DFA is an automata where the next stage that a machine will
move to can be predetermined. It is called finite as it has a finite number of states (Heinz 2017).
In this program, a DFA with 3 states has been taken. Here the alphabet used is a string of infinite
language S. In a DFA, the string or language is accepted only when the first and last state of the
DFA matches. In this program, for easy understanding of the basics, a string which must start
with 1 is taken as input. So for example, if a string is 100112, when the program is run with this
input, the string is not accepted as the first character does not match with the last character and
the first and last states also comes different. In this example, q1 and q2 are the transition states
shown. However, when we take a string say 100121, the first and last character match and we
also get same first and last states. Hence, it is accepted. The main criteria for a DFA to accept
a string is that it should produce the same first and final states. Here the code provided is
written in a very simple manner to reduce complexity in order to demonstrate the basic
functioning of a DFA. Data structures have not been used as DFAs do not have the concept of
memory (Chan 2018). The code is written in C++ language as mentioned in the requirement.
Figure 1Code Image
DFA SIMULATION USING C++ Deterministic Finite Automation_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents