I need help designing an nfa that accepts the words "hello","hello world" and "stay together" the alphabet includes the english alphabet,numbers and symbols. I need help getting started. Anyone has any suggestions?
Asked
Active
Viewed 508 times
1 Answers
0
I would start with a regular expression then work up from there.
A regex for your problem is: hello | hello world | stay together (bear in mind the "hello" is redundant, but you didn't specify it needed to be optimal)
We can then use the rules of construction to convert the regular expression to an nfa. It looks like it is explained pretty well here
since it is just a bunch of concatenation (h-e-l-l-o...) and some unions (those '|' characters mean union), the final nfa will look like the following (except with more concatenations if you want to treat each letter separately):
NOTE: the above image was generated from here and is for the regular expression h|hw|st