Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hash Table 6
# @param {string} key
# @param {*} value
def set(self, key, value):
keyHash = self.hash(key)
self.keys[key] = keyHash
bucketLinkedList = self.buckets[keyHash]
# custom linkedlist find
node = None
currentNode = bucketLinkedList.head
while not currentNode == None and node == None:
for k in currentNode.value:
if k == key:
node = currentNode
break
currentNode = currentNode.next
if node == None:
bucketLinkedList.append({key: value})
else:
node.value[key] = value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.