Transcription of A Fast String Searching Algorithm
{{id}} {{{paragraph}}}
1. Introduction Programming Techniques G. Manacher, Graham Editors A Fast String Searching Algorithm Robert S. Boyer Stanford Research Institute J Strother Moore Xerox Palo Alto Research Center An Algorithm is presented that searches for the location, "i," 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 aver- age) 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.
2. Informal Description The basic idea behind the algorithm is that more information is gained by matching the pattern from the right than from the left. Imagine that pat is placed on top of the left-hand end of string so that the first characters of the two strings are aligned. Consider
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}