Source code for algorithms.searching.rabinkarp_search

"""
    Implementation of Rabin-Karp search on a given string.

    Rabin-Karp Search
    -----------------
    Search for a substring in a given string, by comparing hash values
    of the strings.

    Time Complexity: O(nm)

    Psuedo Code: http://en.wikipedia.org/wiki/Rabin-Karp_algorithm

"""

from hashlib import md5