I have following task (as part of bigger task):
I need to take an k
element from array like data structure and delete it (k is any possible index). Arra
The only data-structure that has a small overhead in adding and removing element is an hashtable. The only overhead is the cost of the hash function (and it is considered as O(1), if you take a purely theoretic approach).
But, if you want it to be extremely efficient, you will need to:
If you manage to get everything right, then you should be optimal.