Skip to content

Instantly share code, notes, and snippets.

@graphoarty
Created February 9, 2019 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphoarty/e4509b485a9f43a5ddcf84052d8a917d to your computer and use it in GitHub Desktop.
Save graphoarty/e4509b485a9f43a5ddcf84052d8a917d to your computer and use it in GitHub Desktop.
Hash Table 5
# @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