I am working on a problem in which I need to read from one hashtable and insert it
into another using a new hash sum. Currently though I am not getting it to insert anything into the table. What am I doing wrong
struct Movie{
std::string title;
Movie *next;
Movie(){};
Movie(std::string in_title){
title = in_title;
next = NULL;
}
};
class HashTable
{
public:
HashTable();
~HashTable();
void createNewHashTable();
private:
int hashSum(std::string x, int tablesize);
int hashSum2(std::string x, int s);
int tableSize;
Movie * hashTable[10];
Movie * newHashTable[10];
};
New Hash Function
1 2 3 4 5 6 7 8 9 10
int HashTable::hashSum2(string inputString, int hashLen)
{
int sum = 0;
for (int i = 0; i < inputString.length(); i++){
if(i%2==0)
sum = sum + inputString[i];
}
sum = sum % hashLen;
return sum;
}