hash tables entrywhich results in the secondary clustering this occurs because the probe equation is based solely on the original hash slot better approach for reducing secondary clustering is to base the probe sequence on the key itself in double hashing when collision occursthe key is hashed by second function and the result is used as the constant factor in the linear probeslot (home hp(key) while the step size remains constant throughout the probemultiple keys that map to the same table entry will have different probe sequences to reduce clusteringthe second hash function should not be the same as the main hash function and it should produce valid index in the range simple choice for the second hash function takes the formhp(key key where is some constant less than for examplesuppose we define second hash functionhp(key key and use it with double hashing to build hash table from our sample keys this results in only two collisionsh( = ( = ( = ( = ( = ( = ( = ( = = = the hash table resulting from the use of double hashing is illustrated in figure the double hashing technique is most commonly used to resolve collisions since it reduces both primary and secondary clustering to ensure every table entry is visited during the probingthe table size must be prime number we leave it as an exercise to show why this is necessary figure the hash table using double hashing rehashing we have looked at how to use and manage hash tablebut how do we decide how big the hash table should beif we know the number of entries that will be