Mental Model
We use a rolling number code for strings to quickly find a pattern inside a text by comparing these codes instead of characters.
Analogy: Imagine checking if a small book page is inside a big book by comparing the sum of letter values instead of reading every letter each time.
Text: T h i s i s a t e x t
Pattern: i s a
Hash codes: [T=84][h=104][i=105][s=115] ...
↑
Sliding window over text