Theoretical Computer Science
Text algorithms
Simple optimal string matching algorithm
Journal of Algorithms
A fast string searching algorithm
Communications of the ACM
Constant-Space String-Matching
Proceedings of the Eighth Conference on Foundations of Software Technology and Theoretical Computer Science
Constant-Space String-Matching in Sublinear Average Time
SEQUENCES '97 Proceedings of the Compression and Complexity of Sequences 1997
Hi-index | 0.00 |
We present a new string matching algorithm linear in the worst case (in O(m + n) where n is the size of the text and m the size of the searched word, both taken on an alphabet Σ) and optimal on average (with equiprobability and independence of letters, in O(m + n log|Σ| m/m)). Of all the algorithms that verify these two complexities, our is the simplest since it uses only a single structure, a suffix automaton. Moreover, its preprocessing phase is linearly dynamical, i.e. it is possible to search the words p1, then p1p2, p1p2p3, . . . , p1p2p3 . . . pi with O(Σ|pi|) total preprocessing time. Among the algorithms that verify this property (for instance the Knuth-Morris-Pratt) our algorithm is the only one to be optimal on average.