DSAverse
String Algorithms
Loading String Algorithms...
Pattern Matching
A
B
A
B
C
A
B
A
B
A
B
A
B
text / pattern
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
String Algorithms
Loading String Algorithms...
Pattern Matching
text / pattern
Slide a rolling hash window across the text. Each position costs O(1) to hash — compare hashes first, then verify on a match.
What is the purpose of the 'rolling hash' in Rabin-Karp?