The Rabin–Karp algorithm is a string-searching algorithm used to find a pattern inside a larger text. It’s especially useful when you need to search for multiple patterns or do repeated searches efficiently.
It uses rolling hashing.
text: a b c d b a c d