Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create two hash tables with size 211, one for Quadratic Probing and the other fo

ID: 3761074 • Letter: C

Question

Create two hash tables with size 211, one for Quadratic Probing and the other for Double Hashing. The hash function h is defined as h(k) = k mod M.

Instead of using the quadratic function, write a variant of the quadratic function f(i) = c1*i + c2*i2, where c1, and c2 are parameters with the following three combinations;

Case 1: c1=1, c2=0.

Case 2: c1=0, c2=1

Case 3: c1=1, c2=25

You will test your program with each combination above to see the cases that improve performance.

Write a double hashing function g(k) = R – k mod R, where R = 113

Use command line arguments in the following order; M, R, c1, and c2.

There is no guarantee of finding an empty slot for Quadratic Probing and Double Hashing. So, you can define the limit of probes with a large number if necessary.

using c++ language and program for quadratic probing and double hashing using the aove instructions

Explanation / Answer

* C++ Program to Implement Hash Tables with Quadratic Probing */ #include #include #define MIN_TABLE_SIZE 10 using namespace std; /* * Node Type Declaration */ enum EntryType {Legitimate, Empty, Deleted}; /* * Node Declaration */ struct HashNode { int element; enum EntryType info; }; /* * Table Declaration */ struct HashTable { int size; HashNode *table; }; /* * Returns whether n is prime or not */ bool isPrime (int n) { if (n == 2 || n == 3) return true; if (n == 1 || n % 2 == 0) return false; for (int i = 3; i * i table[pos].element = key; } } /* * Function to Rehash the Table */ HashTable *Rehash(HashTable *htable) { int size = htable->size; HashNode *table = htable->table; htable = initializeTable(2 * size); for (int i = 0; i table[i].element; if (!value) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote