Abstract

We present a new string matching algorithm optimal on average (with equiprobability and independence of letters, in O(m+nlog|Σ|m/m), where n is the size of the text and m the size of the searched word, both taken on an alphabet Σ) 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 p1, then p1p2, p1p2p3,…,p−1p−2p−3···pi with O(∑|pi|) 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.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call