rendered paste body#include <cstdlib>#include <iostream>using namespace std;#include "table.h"#include "clientProgram.h"table::table(unsigned int hashsize){ adtHashTable = (struct node **) malloc(hashsize * sizeof(node *)); int i; for(i = 0; i < hashsize; i++) { adtHashTable[i] = NULL; }}table::~table(){ }int table::adtHashFunction(const char *cpKey) { unsigned int adtHashPosition = 0; struct node * newnode; newnode = new node; for(int i = 0; i < strlen(cpKey); i++) { //add each letter of the clients key for the hash position adtHashPosition = adtHashPosition + cpKey[i]; } //mod hash position by hash size to get a constrained number adtHashPosition = adtHashPosition % hashsize; if(adtHashTable[adtHashPosition]) { cout << "Collision detected, appending data" << endl; } else { cout << "No collision detected, inserting" << endl; } newnode->next = adtHashTable[adtHashPosition]; newnode->data = strdup(cpKey); adtHashTable[adtHashPosition] = newnode; cout << adtHashTable[adtHashPosition]; } int table::adtRemove(const int hashsize, char * cpKey){ }int table::adtRetrieve(const int hashsize, char * cpKey, char * returnedList){ /* for(int i = 0; i < strlen(cpKey); i++) { adtHashPosition = adtHashPosition + cpKey[i]; } adtHashPosition = adtHashPosition % 1009; */ /* if(adtHashTable[adtHashPosition]) return 1; else return 0; */}