For a fixed word , store the length of the longest suffix of the received stream that is also a prefix of . On a new input symbol, append it to the represented prefix and select the longest resulting suffix that is a prefix of . The complete-word state signals recognition. Its outgoing transitions retain proper suffix matches, allowing overlapping occurrences rather than automatically restarting from the empty prefix. This is the finite-state form of the prefix information used by the Knuth-Morris-Pratt algorithm.
For example, recognizing needs suffix-prefix states of lengths zero through four. After a complete match followed by one, the last two symbols are , so the next state retains length two. This permits the second match in without clearing the useful suffix.

Articles by others on the same topic (0)

There are currently no matching articles.