mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-22 16:31:15 -04:00
Update hash_map_array.py
This commit is contained in:
parent
606784af38
commit
6dc689f3a0
1 changed files with 3 additions and 0 deletions
|
@ -41,4 +41,7 @@ class Bucket:
|
|||
def remove(self, key):
|
||||
for i, k in enumerate(self.bucket):
|
||||
if key == k[0]:
|
||||
# del is an O(n) operation, as we would copy all the i: elements
|
||||
# to make it O(1) we could swap the element we want to remove
|
||||
# with the last element in the bucket
|
||||
del self.bucket[i]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue