Fast algorithm for searching for substrings in a string

Read up on the Aho-Corasick algorithm and the Rabin-Karp algorithm.

If the input is not too large, you don’t want to repeat the search many times and you do not have many patterns, it might be a good idea to use a single pattern algorithm several times. The Wikipedia article on search algorithms gives many algorithms with running and preprocessing times.

Implementations:

Presentations:

Leave a Comment