
CMSC 430, Practice Problems 1
For these practice problems, when creating NFAs from REs, use Thompson’s
construction algorithm, but with a modified algorithm for computing closure. Instead of
adding an epsilon edge from the final state back to the start state of the original NFA, add
the epsilon edge from the final state back to the start state of the new NFA instead. The
resulting NFA should appear as follows:
→
→→
→
1. Describe the languages denoted by the following regular expressions:
a. 0(0|1)∗0
b. ((ε |0)1∗)∗
c. (0|1)∗0(0|1)(0|1)
2. Regular expressions
a. Give a regular expression for all binary numbers including the substring “101”.
b. Give a regular expression for all binary numbers with an even number of 1’s.
c. Give a regular expression for all binary numbers that don’t include “000”.
3. Finite automata
a. Give a NFA that only accepts binary numbers including the substring “101”.
b. Give a NFA that only accepts binary numbers that include either “00” or “11”.
c. Give a NFA that only accepts binary numbers that include both “00” and “11”.
d. Compute the ε-closure of the start state for each of the NFA above.
e. Give a DFA that only accepts binary number with an odd number of 1’s.
f. Give a DFA that only accepts binary numbers that include “000”.
g. Give a DFA that only accepts binary numbers that don’t include “000”.
4. Reducing REs to DFAs
For each regular expression: 1*, (0|01)*0
a. Reduce the RE to an NFA using the modified Thompson’s algorithm above.
b. Reduce the resulting NFA to an DFA using the subset algorithm.
c. Show whether the DFA accepts / rejects the strings “1”, “11”, “101”
d. Minimize the resulting DFA using Hopcroft reduction