Answer: Finite automata

Question: Find a finite automaton that accepts bit strings whose last five bits include a 1.

Answer: This is the set of strings that do not end with 00000 and are not the empty string, 0, 00, 000, or 0000. Here is the transition table with a start state of A.

    input
    0   1
A   B   a  [we have seen nothing so far]
B   C   a  [we have seen 0 so far]
C   D   a  [we have seen 00 so far]
D   E   a  [we have seen 000 so far]
E   f   a  [we have seen 0000 so far]
a   b   a  [we just saw a 1]
b   c   a  [we saw a 1 one bit ago but not since]
c   d   a  [we saw a 1 two bits ago but not since]
d   e   a  [we saw a 1 three bits ago but not since]
e   f   a  [we saw a 1 four bits ago but not since]
f   f   a  [we have seen five zeroes in the last four characters]
The accepting states are a, b, c, d, and e.


Answer / Finite automata / Review questions / 15-211 A, B