{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Boyer - Boyer-Moore-Horspool String Searching As another...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Boyer-Moore-Horspool String Searching As another example of how a class can represent an abstraction, consider the problem of searching a char* string for a given pattern. In the C library there is a strstr() function for doing this. But suppose that we wish to implement our own scheme, based on one of the relatively new high-performance algorithms for searching like the Boyer-Moore-Horspool one (see the book "Information Retrieval" by William Frakes for a description of this algorithm). This particular algorithm does some preprocessing of the pattern, as a means of determining how far to skip ahead in the search text if an initial match attempt fails. The results of the preprocessing are saved in a vector, that is used during the search process. It is quite possible but inconvenient and inefficient to code this algorithm in C, especially if the same pattern is to be applied to a large body of text. If coding in C, the preprocessing would have to be done each time, or else saved in an auxiliary structure that is passed to the search function.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}