Created
February 9, 2019 07:46
-
-
Save graphoarty/e4509b485a9f43a5ddcf84052d8a917d to your computer and use it in GitHub Desktop.
Hash Table 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @params {string} key | |
# @returns {number} | |
def hash(self, key): | |
k = 0 | |
for s in list(md5(str(key).encode('utf-8')).hexdigest()): | |
k += ord(s) | |
return k % len(self.buckets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment