← Back

Karp-Rabin String Matching

Rolling hash compares pattern hash with substrings efficiently.

stringshashingsearchUpdated 2025-09-01

Idea

  • Hash window; update in O(1) as slide

Collision

  • Verify substring on hash match