unsigned int makeHash(const string& key, int prime) { unsigned int h = 0; unsigned int g = 0; for (int i = 0; i < key.length(); i++) { h = (h << 4) + key[i]; if (g = h & 0xf0000000) { h = h ^ (g >> 24); h = h ^ g; } } return h % prime; } Read in 1719 items. LoadFactor = 1. Created 1709 slots. There were 638 total collisions. There were 315 slots that had 1 collisions. There were 118 slots that had 2 collisions. There were 23 slots that had 3 collisions. There were 2 slots that had 4 collisions. There were 2 slots that had 5 collisions. Average number of lookups per item = 1.496800 There were 638 empty slots. 320 even & 318 odd. Read in 1719 items. LoadFactor = 2. Created 3433 slots. There were 366 total collisions. There were 253 slots that had 1 collisions. There were 47 slots that had 2 collisions. There were 5 slots that had 3 collisions. There were 1 slots that had 4 collisions. Average number of lookups per item = 1.251891 There were 2085 empty slots. 1050 even & 1035 odd. Read in 1719 items. LoadFactor = 3. Created 5153 slots. There were 259 total collisions. There were 198 slots that had 1 collisions. There were 27 slots that had 2 collisions. There were 1 slots that had 3 collisions. There were 1 slots that had 4 collisions. Average number of lookups per item = 1.171611 There were 3697 empty slots. 1862 even & 1835 odd. unsigned int makeHash2(const string& key, int prime) { int hashVal = 0; // h(k) = ((kn) * 37 + kn-1) ... * 37 + k0 for(int i = 0; i < key.length(); i++) hashVal = 37 * hashVal + key[i]; hashVal %= prime; if(hashVal < 0) hashVal += prime; return(hashVal); } Read in 1719 items. LoadFactor = 1. Created 1709 slots. There were 626 total collisions. There were 318 slots that had 1 collisions. There were 112 slots that had 2 collisions. There were 24 slots that had 3 collisions. There were 3 slots that had 4 collisions. Average number of lookups per item = 1.481094 There were 626 empty slots. 307 even & 319 odd. Read in 1719 items. LoadFactor = 2. Created 3433 slots. There were 375 total collisions. There were 268 slots that had 1 collisions. There were 42 slots that had 2 collisions. There were 5 slots that had 3 collisions. There were 2 slots that had 4 collisions. Average number of lookups per item = 1.257708 There were 2094 empty slots. 1022 even & 1072 odd. Read in 1719 items. LoadFactor = 3. Created 5153 slots. There were 264 total collisions. There were 194 slots that had 1 collisions. There were 26 slots that had 2 collisions. There were 6 slots that had 3 collisions. Average number of lookups per item = 1.179174 There were 3702 empty slots. 1855 even & 1847 odd.