Simple Optimal String Matching Algorithm

  • Authors:
  • Cyril Allauzen;Mathieu Raffinot

  • Affiliations:
  • -;-

  • Venue:
  • COM '00 Proceedings of the 11th Annual Symposium on Combinatorial Pattern Matching
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.