0

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?

Israel Rodriguez
  • 209
  • 2
  • 8
  • 15

1 Answers1

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):enter image description here

NOTE: the above image was generated from here and is for the regular expression h|hw|st

Community
  • 1
  • 1
Jordan
  • 4,928
  • 4
  • 26
  • 39