What is the complexity of deletion in a hash table? It can vary based on how it is implemented. If it is implemented as a contiguous array, then do we compact the array on deletion (which makes it not O(1))?
If it is doubly linked list based, O(1) deletion is possible but how do we map the hash key to the linked list node in this case? If it is tree based, then it is understandably O(logN).
But deletion in C++ unordered_map and older implementation of HashMap in Java claims to be O(1). Can someone fill in the implementation gaps here?
Edit: Let's assume for simplicity sake, that there are no collisions.
O(1)operations, assuming there are no collisions. With regard to rearranging the underlying structure, even if that happens it might not occur after each operation. - Tim Biegeleisen