I am implementing a Hashtable that uses double hashing. However, I have a problem with my insert(element) method. It basically does the following right now:
I imagine that you should already be keeping track of the number of elements in the table for use with any
size() function, so you could compare the number of elements to the number of buckets to ascertain table fullness. If you are not keeping track of the size, then you should simply start doing so by incrementing and decrementing a counter on your insert and remove operations.
Keeping track of the size is something almost all hash table implementations do in order to avoid O(n) cost for
The above is assuming that you are not allowing multiple elements per bucket as per standard hash tables (which seems to be the case per your description).