0

I have the following regular expression for the set of all strings such that each block of five consecutive symbols contains exactly two 0's (consider the alphabet to be {0, 1}):

(0+1+ϵ)4+(11100+ϵ)r(0011100r)*(00111+ϵ)

r=11+(110+ϵ)s(0110s)*(011+ϵ)

s=(0+10)*(1+ϵ)

How should I convert this into an NFA? Please explain the steps behind it as well!

Jayajit
  • 7
  • 3

1 Answers1

2

What you need is the Berry-Sethi algorithm, constructing the Glushkov's automaton.

However, for your problem, I'd consider constructing directly a DFA with $10 = \begin{pmatrix}5\\2\end{pmatrix}$ states corresponding to words of size 5 containing exactly two zeros, and a sink state (and maybe some other states for the begining of the reading).

The Glushkov's automaton on your regular expression will be very big.

Nathaniel
  • 15,071
  • 2
  • 27
  • 52