Hi I am working on a project using opened addressed hash tables. I have got the hash table part of my code to work fine. I have also gotten the template part to work.
However one of the features of the program is going to be the ability to allow the user to decide what type of input the hash table is going to take in. I want to allow the user to select a type in the main function and then depending on which type they choose pass an object of the hash table class with that type to another class as a parameter. This other class will be a menu class where users can then call functions from the hash table class in order to perform the functions.
template <class T>
class OpenHash
{
private:
vector <T> hashTab;
vector <int> emptyCheck;
int hashF(string);
int hashF(int);
int hashF(double);
int hashF(float);
int hashF(char);
public:
OpenHash(int);
int getVectorCap();
int addRecord (T);
int sizeHash();
int find(T);
int printHash();
int deleteEntry(T);
};
template <class T>
OpenHash<T>::OpenHash(int vecSize)
{
hashTab.clear();
hashTab.resize(vecSize);
emptyCheck.resize(vecSize);
for (int i=0; i < emptyCheck.capacity(); i++)
{
emptyCheck.at(i) = 0;
}
}
Above is the class and constructor of the hash table class.