@article{boyer1977string, abstract = {An algorithm is presented that searches for the location, “il” of the first occurrence of a character string, “pat,” in another string, “string.” During the search operation, the characters of pat are matched starting with the last character of pat. The information gained by starting the match at the end of the pattern often allows the algorithm to proceed in large jumps through the text being searched. Thus the algorithm has the unusual property that, in most cases, not all of the first i characters of string are inspected. The number of characters actually inspected (on the average) decreases as a function of the length of pat. For a random English pattern of length 5, the algorithm will typically inspect i/4 characters of string before finding a match at i. Furthermore, the algorithm has been implemented so that (on the average) fewer than i + patlen machine instructions are executed. These conclusions are supported with empirical evidence and a theoretical analysis of the average behavior of the algorithm. The worst case behavior of the algorithm is linear in i + patlen, assuming the availability of array space for tables linear in patlen plus the size of the alphabet. 3~}, address = {New York, NY, USA}, author = {Boyer, Robert S. and Moore, J. Strother}, doi = {10.1145/359842.359859}, interhash = {4df7c63c9e5aa054a20b177265d6fe79}, intrahash = {bf45f38d1fd1a07a8690339f5a829818}, issn = {0001-0782}, journal = {Communications of the ACM}, month = oct, number = 10, pages = {762--772}, privnote = {initial Boyer-Moore paper}, publisher = {ACM}, title = {A fast string searching algorithm}, url = {http://portal.acm.org/citation.cfm?id=359859}, volume = 20, year = 1977 }