Paper record

W1971820292

On the Worst-Case Behavior of String-Searching Algorithms

Ronald L. Rivest

Year
1977
Venue
SIAM Journal on Computing
References
3
Cited by
74

Details and counts from OpenAlex.

Abstract

Any algorithm for finding a pattern of length k in a string of length n must examine at least n−k+1n - k + 1 of the characters of the string in the worst case. By considering the pattern 00⋯000 \cdots 0, we prove that this is the best possible result. Therefore there do not exist pattern matching algorithms whose worst-case behavior is “sublinear” in n (that is, linear with constant less than one), in contrast with the situation for average behavior (the Boyer-Moore algorithm is known to be sublinear on the average).