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.

Level: intermediateTopic: Data structures algorithms

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.