Rabin-Karp Algorithm
A string-matching algorithm based on rolling hashes that compares hash values to quickly screen potential matches.
Method
Compute hashes of the pattern and text windows; verify character by character when hashes match; rolling hash enables O(1) window updates.
Applications
Plagiarism detection, law (document similarity), bioinformatics (multi-pattern extensions).
Advantages
Average O(n+m); easy to extend to multiple patterns; simple implementation.
Limitations
Worst case O(nm) under severe hash collisions; requires a good hash function. Hash collisions cause false positives; poor worst-case performance.
Alternatives
KMP (deterministic O(n+m)), Boyer-Moore (faster in practice), Aho-Corasick (multi-pattern).
Editorial clarification
Source description reviewed against the method-specific reference. Volume ordering is editorial, not a measured ranking; advantages are conditional rather than benchmark results.
Sources
Educational reference only, not professional advice.
All algorithms