typedefunsignedint unint;
//this bucket is used by the open addressing table
struct openBucket{
bool collision;//whether or not there was a collision at this field
string entry_;
};
//this bucket is used by the seperate chaining table
struct chainBucket{
bool collision;//whether or not there was a collision at this field
List *bucketList;
};
class HashTables{
private:
std::unordered_map<unint,openBucket> openAddressTable;
std::unordered_map<unint,chainBucket> chainingTable;
void HashTables::addToOpenAddress(unint inputHash, std::string text){
openCollisions = 0;
int size = openAddressTable.size();
for (int i = inputHash; i < size; i++) {
if (openAddressTable[i].entry_==text) {
openAddressTable[i].collision = true;
i++;
openCollisions++;
}
else {
openAddressTable.insert = new openBucket->entry_=text;
}
}
}
//TODO
// finish this function to add an element to the separate chaining table
// this tables tracks collisions with linked lists
// if a collision occurs,
// - edit collision boolean for current location
// - add to linked list
// else add new chainBucket to position
void HashTables::addToChaining(unint inputHash, std::string text){
//int size = chainingTable.size();
//for (int i = 0; i < size; i++) {
// if()
//}
std::list <int> ::iterator i;
int size = chainingTable.size();
for (int i = inputHash; i < size; i++) {
auto it = chainingTable[i].bucketList.begin();
if(chainingTable[i].bucketList????)
}
}