PEP8 formatting.

This commit is contained in:
Jakob Stoklund Olesen
2016-05-12 13:37:03 -07:00
parent 6e17d229d0
commit ea46a17f56
8 changed files with 299 additions and 232 deletions

View File

@@ -6,6 +6,7 @@ don't attempt parfect hashing, but simply generate an open addressed
quadratically probed hash table.
"""
def simple_hash(s):
"""
Compute a primitive hash of a string.
@@ -21,6 +22,7 @@ def simple_hash(s):
h = ((h ^ ord(c)) + ((h >> 6) + (h << 26))) & 0xffffffff
return h
def next_power_of_two(x):
"""
Compute the next power of two that is greater than `x`:
@@ -41,6 +43,7 @@ def next_power_of_two(x):
s *= 2
return x + 1
def compute_quadratic(items, hash_function):
"""
Compute an open addressed, quadratically probed hash table containing