Paper record

W4239658213

On the Exact Complexity of String Matching: Upper Bounds

Zvi Galil, Raffaele Giancarlo

Year
1992
Venue
SIAM Journal on Computing
References
17
Cited by
54

Details and counts from OpenAlex.

Abstract

It is shown that, for any pattern of length m and for any text of length n, it is possible to find all occurrences of the pattern in the text in overall linear time and at most 43n−13m\frac{4}{3}n - \frac{1}{3}m character comparisons. In fact, the bound on the number of character comparisons is usually tighter than this, for the bound is expressed in terms of the structure of the pattern. The algorithm here need not have any knowledge of the alphabet. This improves the best previous bound of 1.5n−.5(m−1)1.5n-.5(m - 1) obtained by Colussi [Inform. and Comput., to appear] and Apostolico and Crochemore [Tech. Report TR89-75, LITP, Université de Paris, Paris, France, 1989]. In a companion paper [SIAM J. Comput., 20 (1991), pp. 1008–1020], the authors show a lower bound for on-line algorithms that is equal to 43n−13m\frac{4}{3}n - \frac{1}{3}m for m=3m = 3. For m=1,2,nm = 1,2,n character comparisons is optimal. This algorithm is based on a new analysis of the string matching algorithm by Colussi. Moreover, this new analysis of Colussi’s algorithm confirms the experimental results showing that his algorithm performs very well in practice [Inform. and Comput., to appear].