Chnaged hash method for dictionary to hash cod + mad
This commit is contained in:
85
com/xgiovio/ChainingHashTableTest.java
Normal file
85
com/xgiovio/ChainingHashTableTest.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package com.xgiovio;
|
||||
|
||||
import dictionary.ChainingHashTable;
|
||||
import dictionary.LogFile;
|
||||
import priorityqueue.Entry;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created with MONSTER.
|
||||
* User: xgiovio
|
||||
* Date: 11/05/2014
|
||||
* Time: 21:17
|
||||
*/
|
||||
public class ChainingHashTableTest {
|
||||
|
||||
public static void main(String[] args) throws InvalidKeyException{
|
||||
|
||||
ChainingHashTable<String,Integer> h = new ChainingHashTable<String, Integer>();
|
||||
|
||||
System.out.println(h.load_factor());
|
||||
|
||||
h.insert("1", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
|
||||
h.insert("2", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("3", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("4", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("5", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("6", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("7", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("7", 200);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("7", 511);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("8", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
h.insert("9", 100);
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
Entry<String,Integer> t = h.insert("10", 100);
|
||||
|
||||
System.out.println(h.load_factor());
|
||||
System.out.println(h.size());
|
||||
|
||||
|
||||
System.out.println(h);
|
||||
System.out.println(h.raw_size());
|
||||
|
||||
|
||||
Iterator<Entry<String,Integer>> ite = h.findAll("9").iterator();
|
||||
System.out.println(ite.next());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user