Question: / * * * * * * * * * * * * * * * * * * * * * * * *
macro guard
#ifndef hashtableh
#define hashtableh
System includes
#include
#include
#include
local includes
template
class HashTable
data memeber: bucket array a list vector
Each list is a pair list
std::vector table;
public:
constructor
HashTable
TO DO
HashTableint size ;
make a HashTable of size as per the specified f key
Hash Function
Division Hashing with a prime number close to the data size
int hashfunctionconst int& key
return key ;
insert into the table
void insertconst int& key, const T& value
TO DO
Hint: use std::makepairkey value to create a pair
erase the with key "key"
return true if "key" exists and the pair erased
return false if "key" does not exist
bool eraseconst int& key
TO DO
Hint: use pairobj.first to return the first value of a pair object
pairobj.secod to return the second value of a pair object
find the value with key "key"
If "key" exists, return true and the value
else return false and a defaul meaningless value
std::pair findconst int& key
TO DO
Dont forget it should return a pair
modify the value with key "key"
If "key" exists, modify it's value to "value", and return true
else return false
bool modifyconst int& key, const T& value
TO DO
;
#endif
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
