A Fast String Searching Algorithm

A Fast String Searching Algorithm

October 1977 | Robert S. Boyer, J Strother Moore
This paper presents a fast string searching algorithm that efficiently finds the first occurrence of a pattern in a text. The algorithm starts matching from the end of the pattern and uses precomputed tables to determine how far the pattern can be shifted when a mismatch occurs. This allows the algorithm to skip over large sections of the text, making it more efficient than traditional linear search methods. The algorithm's performance is analyzed both empirically and theoretically, showing that it is typically sublinear in the number of characters inspected and instructions executed. The algorithm's worst-case behavior is linear in the length of the pattern and the text. The paper also discusses implementation considerations, including the use of byte-addressable machines and the impact of secondary storage on performance. Theoretical analysis supports the empirical evidence, showing that the algorithm is sublinear in the average case for sufficiently large alphabets and patterns. The paper concludes with a discussion of the algorithm's history and limitations, noting that it may not be the best choice for all scenarios, particularly when the pattern is short or the alphabet is large.This paper presents a fast string searching algorithm that efficiently finds the first occurrence of a pattern in a text. The algorithm starts matching from the end of the pattern and uses precomputed tables to determine how far the pattern can be shifted when a mismatch occurs. This allows the algorithm to skip over large sections of the text, making it more efficient than traditional linear search methods. The algorithm's performance is analyzed both empirically and theoretically, showing that it is typically sublinear in the number of characters inspected and instructions executed. The algorithm's worst-case behavior is linear in the length of the pattern and the text. The paper also discusses implementation considerations, including the use of byte-addressable machines and the impact of secondary storage on performance. Theoretical analysis supports the empirical evidence, showing that the algorithm is sublinear in the average case for sufficiently large alphabets and patterns. The paper concludes with a discussion of the algorithm's history and limitations, noting that it may not be the best choice for all scenarios, particularly when the pattern is short or the alphabet is large.
Reach us at info@study.space
[slides] A fast string searching algorithm | StudySpace