Skip to content

Instantly share code, notes, and snippets.

@usirin
Forked from anonymous/main for myHash, test.
Created December 31, 2016 14:06
Show Gist options
  • Save usirin/030ae0d0d96940fd9db0153085d9113f to your computer and use it in GitHub Desktop.
Save usirin/030ae0d0d96940fd9db0153085d9113f to your computer and use it in GitHub Desktop.
package myHashTable;
import java.util.Arrays;
public class assignment {
public static void main(String[] args) {
// keys to add
int[] keys = {517, 492, 27, 116, 132, 30, 552, 725, 627, 192};
System.out.println("Keys to Add: " + Arrays.toString(keys));
// HASH TABLE PROPERTIES
int capacity = 10;
double max_load_factor = 0.8;
int resize_factor = 2;
int probe_type = 1; // 1: Linear Probing, 2: Quadratic Probing
myHash hashTable = new myHash(capacity,max_load_factor,resize_factor, probe_type);
// add keys to the hash table
for (int i = 0; i<keys.length; i++)
hashTable.add(keys[i]);
hashTable.printHashTable(); // print hash table contents and statistics // Create another hash table to test quadratic probing
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment