AI engineering glossary · Data structures algorithms
What is string matching?
String matching (also called substring search): The problem of finding where a short pattern occurs within a longer text. The naive method compares at every position in O(n*m) time, while smarter algorithms reduce this using precomputed information or hashing.
String matching: an example
Finding 'error' in a 10 MB log file can be done in one pass using algorithms such as KMP.
Related terms
More Data structures algorithms terms
- Tabulation
- Time complexity
- Timsort
- Top-K problem
- Topological sort
- Traveling salesman problem
- Tree
- Tree traversal
Where you learn it
String matching is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.