Question: Define and implement the class IntegerValue (provided in LA12.zip file) that has the following hashing functions. int Hash() int LinearRehash(int initial_hash_value) int QuadraticRehash(int initial_hash_value, int
Define and implement the class IntegerValue (provided in LA12.zip file) that has the following hashing functions.
int Hash()
int LinearRehash(int initial_hash_value)
int QuadraticRehash(int initial_hash_value, int times)
int PseudorandomRehash(int current_hash_value,int table_size)
int DoubleRehash(int key)
IntegerValue.h
#ifndef i1_h
#define il_h
#include
#include
using namespace std;
const int MAX_ITEMS = 100;
class IntegerValue
{
public :
IntegerValue(int idd =-1);
bool operator ==( const IntegerValue &);//Equality
bool operator <( const IntegerValue &);//Less than
bool operator >( const IntegerValue &);//Greater thany
void setId(int value) ;
int getId();
int Hash();
int LinearRehash(int initial_hash_value) ;
int QuadraticRehash(int initial_hash_value, int times,int sign) ;
int keyProbeDoublehash(int id, int i, int size);
int PseudorandomRehash(int current_hash_value,int table_size);
bool isNull();//Returns true id==-1
void Print() const;
private :
int id ;
};
#endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
