The hash value for key is caculated and is divided by a prime number.
In general, Is there any standard prime number (say for 32/64 bit) for this?
My understanding is the hashtable is not resizable/adjustable and its internal array depends on this. If I have a hashtable for only 5 elements will there be waste in key space?
Edit: I should have framed this better. What is general approach followed in c++ hash_map (boost) or C# Dictionary
In fact, hash tables sizes can be adjustable automatically. What you might do is allocate an array of size N, using a hash modulo N (some prime number) for indexing into the array. If you keep track of the density of your allocation, then when it increases beyond some threshold you can allocate a new array of size N1 (some larger prime number), and copy over each element from the old array, applying the hash function with the new modulo to find its place in the new hash table. Finally you deallocate the old array and use the new, larger array.