Abstract

This chapter focuses on string search and translation. Much work has been done on algorithms for efficient string searching. The problem can be generally stated as finding the occurrence of a given string pattern within a given text string. Complicated techniques, such as the Boyer–Moore algorithm and the Knuth–Morris–Pratt algorithm, have been shown to be more efficient on a theoretical basis, but the brute force method has been highly optimized by the 80×86 architecture. The brute force method involves scanning the text string for a match of the first character of the string pattern. If a match is found, then the rest of the pattern is checked. Scanning then continues on the character after the initial match. This algorithm works well when there are relatively low number of scan matches and a small pattern. It is fast because the inner loop for this type of routine has only one instruction. There are a number of algorithm optimizations that can be applied to the brute force method. The basic algorithm is to scan a string, converting each character to a decided-upon case, and comparing it. When a match is found, the full string is compared, converting each character before the compare.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.