Overview
In Chapter 20 we discuss string matching algorithms including some classical algorithms
based on preprocessing the pattern string, an approximation string matching algorithm
and string matching algorithms based on preprocessing the text. We begin the chapter by
discussing the string matching problem and the naïve algorithm for solving the problem.
In the next three chapters we discuss three standard string-matching algorithms, the
Knuth, Morris, and Pratt (KMP) algorithm; the Boyer and Moore (BM) algorithm; and the
Karp and Rabin (KR) algorithm. The KMP and BM string matching algorithms preprocess
the pattern string so that information gained during a search for a match of the pattern
facilitate very fast searching of a pattern string.
Chapter Objectives
After completing the chapter the student will know:
• The KMP string-matching algorithm
• The BM string-matching algorithm
• The KR string-matching algorithm
• The concept of the edit distance between two strings
• A dynamic programming algorithm for computing the edit distance
• The concepts of trie, compressed trie (PATRICIA tree), and suffix tree
• Algorithms for searching tries, compressed tries and suffix trees for a given pattern
string