Question: Write a method that emulates a general finite automaton. The input to this method should include: the number N of states q 0 , ...,
Write a method that emulates a general finite automaton. The input to this method should include:
- the number N of states q0, ..., qN 1; we assume that q0 is the start state;
- the number M of symbols s0, ... sM 1;
- an integer array state[n][m] that describes to what state the finite automaton moves if it was in the state qn and sees the symbol sm;
- a boolean array final[n] that tells us, for each state, whether this state is final or not.
Your program should emulate the work of the finite automaton step-by-step. Return the printout of the method, the printout of the program that you used to test this method, and the printout of the result of this testing. Feel free to use Java, C, C++, Fortran, or any programming language in which the code is understandable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
