def hashtable_add(htable, key, value): # find which bucket it needs to go in index = HashString.hash_string(key, len(htable)) bucket = htable[index] # add it to that bucket bucket.append([key, value])
def hashtable_get_bucket(hashtable, keyword): bucket_count = len(hashtable) index = HashString.hash_string(keyword, bucket_count) bucket = hashtable[index] return bucket