/* CSI2114 Lab 9 - testHashingFunctions.java * * tests five hashing functions: calculates number of collisions for each one. * * Usage: java hash * * by Jeff Souza * */ public class testHashingFunctions { public static void main(String[] args) { final int numHashFunctions = 5; final int numAddresses = 997; final int numKeys = 800; // the hash tables -> keep track of only the number of keys per address int[][] hashTable = new int[numHashFunctions][numAddresses]; // total number of collisions of each function int[] totNumCollisions = new int[numHashFunctions]; // creates a random number, calculates its hash value and adds to its address for (int i=0; i1) totNumCollisions[k] += (hashTable[k][j]-1); } } // reports the total number of collisions for (int k=0; k