simulate Nondeterministic Finite State Automata (NFA) with λ-transition and write regular expression
Budget: $10 – $30 USD
A. The objective of this question is to simulate Nondeterministic Finite State Automata
(NFA) with λ-transition. The inputs to the simulation are:
1. The alphabet
2. Number of states in NFA
3. Start state(s)
4. Final state(s)
5. Transition function (from_state, symbol, to_state)
For simplicity the states are numbered 1, 2, 3, …. You may also use # in place of λ in the
transition function.
The next input is the string which the NFA will work on. During the simulation as you
process each symbol from the string, print the symbol and the set of state(s) you end
up at. Once the entire string is processed, print the message "Input Accepted" or "Input
Rejected".
Simulate your NFA on,
Using the inputs: aaaa, ba, ab, aaababa
Write-up of the question (a brief description of your algorithm; the data
structure used; cost analysis; sample runs and the conclusion). Should be
typewritten.
B. By using regular expression : Write a python script to extract and list all words that meet the following condition : Recursively remove all consecutive k identical characters from a string. For example, for k = 2, “abccbcbb” -> “abbc” -> “ac”.
(NFA) with λ-transition. The inputs to the simulation are:
1. The alphabet
2. Number of states in NFA
3. Start state(s)
4. Final state(s)
5. Transition function (from_state, symbol, to_state)
For simplicity the states are numbered 1, 2, 3, …. You may also use # in place of λ in the
transition function.
The next input is the string which the NFA will work on. During the simulation as you
process each symbol from the string, print the symbol and the set of state(s) you end
up at. Once the entire string is processed, print the message "Input Accepted" or "Input
Rejected".
Simulate your NFA on,
Using the inputs: aaaa, ba, ab, aaababa
Write-up of the question (a brief description of your algorithm; the data
structure used; cost analysis; sample runs and the conclusion). Should be
typewritten.
B. By using regular expression : Write a python script to extract and list all words that meet the following condition : Recursively remove all consecutive k identical characters from a string. For example, for k = 2, “abccbcbb” -> “abbc” -> “ac”.