StringsExplained
Aho–Corasick Algorithm
A trie with failure links that matches many patterns in one pass.
Time
O(n + m + z)
Extra space
O(m)
Use it for
Searching a dictionary of words in text.
A trie with failure links that matches many patterns in one pass.
Time
O(n + m + z)
Extra space
O(m)
Use it for
Searching a dictionary of words in text.