Chapter 16: String Algorithms. 25 sections.
25 items
Given a text string and a pattern string, determine whether the pattern occurs in the text and, if so, find all positions where the match begins.
The naive exact matching algorithm repeatedly compares the same characters after every mismatch.
Many string algorithms need to answer the question: > How many characters match between a string prefix and a substring starting at a particular position?
Suppose you need to search for a pattern inside a large text.
Most exact matching algorithms process the text from left to right.
Suppose you need to search for many patterns simultaneously.
Suppose you need to search a text for thousands of patterns simultaneously.
Suppose you need to answer many substring queries against the same text.
In the previous recipe, you built a suffix array and used it to perform efficient substring searches.
Suppose you need to answer questions such as: - Does a substring occur in the text?
Many string algorithms focus on prefixes, suffixes, or arbitrary substrings.
You need to find palindromic substrings efficiently.
Exact matching assumes that strings must be identical.
Given two strings, find the longest contiguous block of characters that appears in both.
Many string algorithms depend on a precise ordering of strings.
Many string algorithms repeatedly compare substrings.
Many strings contain repeated structure.
Many string algorithms assume that a string is simply a sequence of characters.
Most string algorithms operate on characters.
This chapter introduced a large collection of string-processing techniques: - Naive matching - KMP - Z Algorithm
A single pattern search scans one text once.
Throughout this chapter, we studied individual string-processing techniques: - Tokenization - Tries - Hashing
String algorithms often look deceptively simple.
String algorithms are easy to implement incorrectly.
After learning dozens of string algorithms, a natural question remains: > What do real systems actually do?