Skip to content

Latest commit

 

History

History
 
 

rabin_karp

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Rabin Karp

In depth reference Wikipedia

Rather than pursuing more sophisticated skipping, the Rabin–Karp algorithm seeks to speed up the testing of equality of the pattern to the substrings in the text by using a hash function. A hash function is a function which converts every string into a numeric value, called its hash value; for example, we might have hash("hello")=5. The algorithm exploits the fact that if two strings are equal, their hash values are also equal. Thus, string matching is reduced (almost) to computing the hash value of the search pattern and then looking for substrings of the input string with that hash value.