String Matching
Everything on SkillVeris tagged String Matching — collected across the glossary, study notes, blog, and cheat sheets.
4 resources across 1 library
Interview Questions(4)
What is the KMP String Matching Algorithm?
The Knuth-Morris-Pratt (KMP) algorithm finds all occurrences of a pattern in a text in O(n + m) time by precomputing a failure function (also called the longes…
What is the Rabin-Karp Algorithm?
Rabin-Karp finds pattern occurrences in a text by hashing the pattern and every equal-length substring of the text using a rolling hash, comparing hash values…
What is the Z-Algorithm for String Matching?
The Z-algorithm computes, for every position in a string, the length of the longest substring starting there that also matches a prefix of the whole string, bu…
Knuth-Morris-Pratt vs Rabin-Karp: What is the Difference?
KMP guarantees O(n + m) worst-case time by precomputing a failure function that avoids re-scanning matched characters after a mismatch, while Rabin-Karp uses r…