Aho-Corasick Algorithm
A multi-pattern string-matching algorithm that finds all occurrences of a set of patterns in a single scan.
Method
Build a trie with failure links so that a mismatch jumps to the longest suffix; time complexity O(M+n), where M is total pattern length.
Applications
Intrusion detection, antivirus signature scanning, legal keyword retrieval, software engineering (fgrep).
Advantages
Optimal linear-time multi-pattern matching; excellent for fixed pattern sets.
Limitations
Memory grows significantly with the number of patterns; difficult to parallelize; false-positive verification overhead. High memory consumption; not friendly to dynamic pattern sets.
Alternatives
Wu-Manber, Commentz-Walter, Rabin-Karp multi-pattern variants.
Editorial clarification
Source description reviewed against the method-specific reference. Volume ordering is editorial, not a measured ranking; advantages are conditional rather than benchmark results.
Sources
Educational reference only, not professional advice.
All algorithms