diff --git a/solutions/object_oriented_design/hash_table/hash_map.py b/solutions/object_oriented_design/hash_table/hash_map.py index 33d9a35d..d90a2743 100644 --- a/solutions/object_oriented_design/hash_table/hash_map.py +++ b/solutions/object_oriented_design/hash_table/hash_map.py @@ -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')