3 ms·
Thanks for this (and parent reply for mentioning it), that's simple and clever! > The basic idea is not complex: when we delete an element, we move the next el
by benhoyt 6y ago
Thanks for this (and parent reply for mentioning it), that's simple and clever!
> The basic idea is not complex: when we delete an element, we move the next element to the deleted location if it is pushed away by the deleted element due to hash collision; we repeat this process until we come to an empty bucket.
I wonder, is it still amortized constant time? My gut (which is not very good at computer science) tells me that it still may be, as with an average probe length of ~1.4 (which I was seeing), you won't have to walk more than 1 or 2 elements on average.
- hnfong 6y agoIt shouldn't take more operations (asymptotically) to delete than to probe/insert so as long as the original list is still amortized constant time then the delete operation still is.