son is done to check if a match exists. The worst case time complexity of Rabin-Karp is `O(m * n)` where `m ~ len(needle)` and `n ~ len(haystack)`. Its worst case space complexity is constant. The main utility of Rabin-Karp is that the searcher can be constructed very quickly with very little memory. This makes it especially useful when searching for small needles in small haystacks, as it might finish its search before a beefier algorithm (like Two-Way) even starts. [rabinkarp]: https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm