The transition table,
transition has one row per state
and a column for each possible input character.
For this implementation, there is a column for each ascii character,
including unprintable characters,
although not all characters are legal in our strings.
(There are other ways to implement the transition table, but this
way is flexible.)
The table looks like this:
The actual Java array has one column for each potential input character.
But the table abbreviates this by representing the characters preceding and following a, b, c as
The dash - means the reject state (actually a -1 in the table).
Most of the table is filled with -1. But implementing a more compact table would call for more logic in the program.
There are as many rows as needed (one per state), and there are no extra rows for unused states.
How should the table be altered so that state 2 makes a transition to state 0 when the current character is 'b' ?