Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash表的问题 #5

Open
LTitan opened this issue Jan 26, 2022 · 2 comments
Open

Hash表的问题 #5

LTitan opened this issue Jan 26, 2022 · 2 comments

Comments

@LTitan
Copy link

LTitan commented Jan 26, 2022

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,是有问题的

@wolverinn
Copy link
Owner

抱歉,之前看到了但一直忘记回复了。我看了下代码,确实会有你说的问题,我之后会改一下。谢谢~

@wolverinn
Copy link
Owner

谢谢,我已经改了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants