Simple optimal string matching algorithm
Résumé
We present a new string matching algorithm optimal on average (with equiprobability and independence of letters, in O(m + n log(\Sigma\) m/m), where n is the size of the text and m the size of the starched word, both taken on an alphabet Sigma) and linear in the worst case (in O(m + n)). Of all the algorithms that verify these two complexities. ours 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 p(1), then p(1) p(2), p(1) p(2)p(3),,,., p(1) p(2)p(3).,. p(i) with O(Sigma\p(i)\) total preprocessing time, Among the algorithms that verify this property (for instance, the Knuth-Morris-Pratt algorithm) our algorithm is the only one to be optimal on average. (C) 2000 Academic Press.