#include #include #include #include /* the plan: array of 1000 ints, all set to zero: counts generate 1000000 random strings for each: calculate h = hash(s) % 1000 add 1 to count[h] make sure all counts roughly the same */ const int array_size = 1000, num_experiments = 1000000; int hash(string s) { int h=1; for (int i=0; i