Question: Use class that I provided below. You ARE NOT ALLOWED to use any data structure or algorithm related function from the C + + standard
Use class that I provided below.
You ARE NOT ALLOWED to use any data structure or algorithm related function from the C standard template library STL or any other external libraries.
Main method MUST be in Subtaskcpp class
#ifndef HOMEWORKHASHTABLEH
#define HOMEWORKHASHTABLEH
#include
#include
class HashTable
private:
public:
HashTable;
~HashTable;
void insertconst std::string& key;
bool searchconst std::string& key;
static const int TABLESIZE ;
struct Node
std::string key;
Node next;
Nodeconst std::string& key : keykey nextnullptr
;
Node tableTABLESIZE;
;
#endif
HashTablecpp class
#include "HashTable.h
HashTable::HashTable
for int i ; i TABLESIZE; i
tablei nullptr;
HashTable::~HashTable
for int i ; i TABLESIZE; i
Node current tablei;
while current nullptr
Node temp current;
current currentnext;
delete temp;
void HashTable::insertconst std::string& key
int hash ;
for char c : key
hash hash c TABLESIZE;
Node newNode new Nodekey;
newNodenext tablehash;
tablehash newNode;
bool HashTable::searchconst std::string& key
int hash ;
for char c : key
hash hash c TABLESIZE;
Node current tablehash;
while current nullptr
if currentkey key
return true;
current currentnext;
return false;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
