String Pattern Matching: Naive, KMP, and Rabin-Karp
A practical tour of substring search — the naive O(n·m) scan, the KMP algorithm with its LPS array, and the Rabin-Karp rolling hash. Worked examples, code, and intuition for when to use each.
·8 min read · #dsa#strings#intermediate