pull/469/merge
John Vector 2024-12-02 18:04:57 +00:00 committed by GitHub
commit 277c07f8a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class HashTable(object):
hash_index = self._hash_function(key)
for index, item in enumerate(self.table[hash_index]):
if item.key == key:
del self.table[hash_index][index]
self.table[hash_index][index],self.table[hash_index][-1] = self.table[hash_index][-1],self.table[hash_index][index]
self.table[hash_index].pop()
return
raise KeyError('Key not found')