Chapter 12 Python hash function modulus selection

#1

In the Python book page 171 in Chapter 12 Hash Tables, there is this hash function:

def string_hash(s, modulus):
    mult = 997
    return reduce(lambda x, y: (x * mult + ord(y)) % modulus, s, 0)

How do you determine what number to use as modulus when calling the function?

0 Likes