- Daniel D'alessandro
- Henry Dinhofer
- Tamer Wahba
This is project is aimed at testing hash table performance based on different hashing algorithms as well as input types. Data values are generated using a python script.
HashTable(METHOD m, int size)
- initializes hash table with size
size
and hashing algorithmm
- initializes hash table with size
void insert(int key, int value)
- inserts
value
into table based onkey
- inserts
int find(int key)
- returns value that corresponds to key, returns
<= -1
if not found
- returns value that corresponds to key, returns
bool delete(int key)
- deletes value in table and returns
true
, returnsfalse
if key not found
- deletes value in table and returns
int hashKey(int key)
-- Dan- hashes
key
based on specified method and returns its location in the table
- hashes
int perfectHashKey(int key)
-- Tamer- hashes
key
to find inner index for perfect hashing method
- hashes
int linearHash(int key)
-- Dan- hashes
key
linearly
- hashes
int quadraticHash(int key)
-- Henry- hashes
key
using quadratic hash method
- hashes
int doubleHash(int key)
-- Tamer- hashes key using double hashing
int perfectHash(int key)
-- Tamer- hashes
key
using perfect hashing method
- hashes
std::vector<int> openTable
- only in use for the open addressing methods
std::vector<std::vector>> perfectTable
- only in use for perfect hashing method
11
INSERT 3
20 5
15 3
12 4
DELETE 1
15
FIND 2
20
12
INSERT 1
4 10
- The first line indicates the number of following lines in the file (for parsing simplicity)
- It must be directly followed by one of three commands:
INSERT
,DELETE
, orFIND
- The commands are followed by a number to indicate the number of operations
FIND
andDELETE
commands are composed of only the key to operate onINSERT
commands have the key followed by a space then a value. Both are numbers
- There can be any combination and repitition of the three commands