Question: Double hashing and prime function Please implement these functions in c++, or give the simple pseudocode for these functions in c++. And if you exactly

Double hashing and prime function

Please implement these functions in c++, or give the simple pseudocode for these functions in c++. And if you exactly don't know the answer, please write something about these functions so that I can understand them.

HashMap::HashMap(int size) : table(size){

//set the variable p to the first prime smaller than size

}

int HashMap::findEmptyIndex(int key) const{

//Use double hashing probing strategy to find empty index:

//(hash1(key) + i * hash2(key)) % table.size()

//Return an index in the table that is not yet Filled.

}

int HashMap::findIndexOfKey(int key) const{

//Use the double hashing probing strategy:

//(hash1(key) + i * hash2(key)) % table.size()

//Keep looking if entry is EmptyAfterRemoval and stop if entry is EmptySinceStart

//stop search after visiting table.size() entries.

//Return the index in the table that contains key, or -1 if it doesn't exist

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!