CSCI 301 L21 Worksheet

Lecture 21 - Exercises

Part A - NFA Design

Draw a diagram for an NFA that accepts each of the following languages over the alphabet \(\{a, b\}\).

  1. \(L = \{a\}\)
  2. \(L = \{w : w \text{ ends with } ab\}\)
  3. \(L = \{w : w \text{ contains an odd number of $a$'s or exactly two $b$'s}\}\)

Part B - NFA-DFA Conversion Warmup

  1. Consider the NFA below. Ignoring \(\epsilon\) transitions, in which states could the machine be in after processing the string \(aaa\)?
  2. Same question, but now allow for \(\epsilon\) transitions.

nfa_table

Part C - NFA-DFA Conversion

The \(\epsilon\)-closures of the states are as follows:

  1. Complete the state transition table of the equivalent DFA, including only reachable states:
Start/Accept? State \(a\) \(b\)
Start \(\{1, 2\}\) \(\{1, 2, 3\}\) \(\varnothing\)
\(\{1, 2, 3\}\) \(\{1,2,3\}\) \(\{2, 3\}\)
  1. Which of the states in the DFA are accept states?
  2. Draw a diagram of the converted DFA.

Part D - Extra Practice NFA-DFA Conversion

Consider the following NFA:

  1. Write its state transition table. This should have four columns: State, \(a\), \(b\), and \(\epsilon\).
  2. Give the \(\epsilon\)-closure of each state:
    1. \(C_\epsilon(0) =\)
    2. \(C_\epsilon(1) =\)
    3. \(C_\epsilon(2) =\)
  3. Construct the transition table for the equivalent DFA; this table should have three columns: State, \(a\), and \(b\). You do not need to include unreachable states.