ACM Home Page
Please provide us with feedback. Feedback
A fast string searching algorithm
Full text PdfPdf (1.19 MB)
Source
Communications of the ACM archive
Volume 20 ,  Issue 10  (October 1977) table of contents
Pages: 762 - 772  
Year of Publication: 1977
ISSN:0001-0782
Authors
Robert S. Boyer  Stanford Research Institute, Menlo Park, CA
J. Strother Moore  Xerox Palo Alto Research Center, Palo Alto, CA
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 55,   Downloads (12 Months): 371,   Citation Count: 198
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/359842.359859
What is a DOI?

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~


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
 
3
Dewey, G. Relativ Frequency o f English Speech Sounds. Harvard U. Press, Cambridge, Mass., 1923, p. 185.
 
4
Knuth, D.E., Morris, J.H., and Pratt, V.R. Fast pattern matching in strings. TR CS-74-440, Stanford U., Stanford, Calif., 1974.
 
5
Knuth, D.E., Morris, J.H., and Pratt, V.R. Fast pattern matching in strings. (to appear in SIAM J. Comput.).

CITED BY  198

Collaborative Colleagues:
Robert S. Boyer: colleagues
J. Strother Moore: colleagues