Question: In c + + This project is designed to help students to understand the HashTable and algorithms related to HashTable. The students need to implement
In c
This project is designed to help students to understand the HashTable and algorithms related to HashTable. The students need to implement two given classes: MyHashEntry and MyHashTable.
Three classes are given. The students shall not modify the CSCIProjThree.cpp file. However, the students should understand this file. The other file, MyHashTable.h are the file that the students need to finish.
This file MyHashTable.h must be implemented with in the given design. The students cannot change the name of public methods. Please notice that the table must be implemented as generic data structure.
CSCIProjThree.cpp
CSCIProjThree. It is an interactive file for MyHash Table
@author Mike Mireku Kwakye
@version October
#include
#include
#include "MyHashTable.h
using namespace std;
void menu; print out the menu
int main
string value;
string key;
int choice;
MyHashTable table;
do
menu;
cout "Enter your choice:
;
cin choice;
switchchoice
case :
cout "Enter an Key Value pair that you will add to table
;
cout "Separate by white space: ;
cin key;
cin value;
table.insertkey value;
cout key value entered
;
break;
case :
cout "Enter a key that you will remove from table:
;
cin key;
value table.removekey;
ifvalueempty
cout "Remove successfully. The removed value is value;
else
cout No such key in table";
break;
case :
cout "Enter the key that you want to search for: ;
cin key;
value table.getkey;
ifvalueempty
cout No such data in table
;
else
cout "The corresponding value is: value endl;
break;
case :
iftableisEmpty
cout "table is empty
;
else
printTabletable;
break;
case :
cout "Make sure you run enough test before you turn it in
;
break;
default:
cout "Wrong option. Please choose from menu
;
break;
whilechoice ;
void menu
cout endl;
cout MENU endl;
cout Add a key value pair endl;
cout Remove a value by its key endl;
cout Search a value by its key endl;
cout Print out hash table endl;
cout Quit endl;
cout endl;
MyHashTable.h
CSCIProjThree A simple HashTable. Collision handling is by Chaining
@author Your Name
@version Date
#include
using namespace std;
#ifndef MyHashTableh
#define MyHashTableh
template
struct MyHashEntry
K key;
V value;
MyHashEntry next;
;
template
class MyHashTable
public:
template
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
