import java.util.*;
import java.io.*;

/**************************************************
 * Reads 5-letter words from words.dat and inserts these
 * into the hash table to test how well the hash function works.
 * @author: Sriram Pemmaraju
*/

public class ChainingHashTableTester{

	public static void main(String args[])
	{
		String[] wordList;
		ChainingHashTable T;

		T = new ChainingHashTable(5800);
		
		try
		{
			// This is one way to read from a file. The list of all 5-letter words
			// is in a file called words.dat
			BufferedReader in = new BufferedReader(new FileReader("words.dat"));
			String word;

        		// read all the words from the file                
			System.out.println( "Reading words.dat..." );
			while( (word = in.readLine()) != null )
			{
				// make a new vertex w/ this word
				T.insert( word );

			}
			in.close();
		}
		catch (IOException e) {}

		System.out.println("Done inserting the words....");
		System.out.println("The word distribution is....");
		T.printDistribution();
	}

}
