Wrapping Up
The Rabin-Karp algorithm uses a number of the techniques we’ve learned about in the past few chapters. From division hashing to Monte Carlo, we’ve pulled out all the stops. And the result is phenomenal: we’ve achieved linear-time substring search.
We also looked at the important concept of base number systems, which will also be crucial for the upcoming chapters. Finally, we’ve also seen how sometimes it’s possible to convert a Monte Carlo algorithm into a Las Vegas algorithm and eliminate the chance for any inaccuracies.
I recommend that you also check out other linear-time substring search algorithms such as KMP and Boyer-Moore, as they’re fascinating and use a completely different approach than Rabin-Karp. Indeed, each of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access