Skip to content

Hash表的问题 #5

@LTitan

Description

@LTitan

def insert(self, key, value):
index = self.hash_code(key)
head = self.table[index]
if not head: # 如果哈希表对应位置还是空的
self.table[index] = listNode(key, value)
else:
while head.next:
head = head.next
head.next = listNode(key, value)
这里insert重复的key,是有问题的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions