Question
c++ code The pseudo code of the hash function is given as follows. int hash(const string &key) { int value = 1; for (int position
c++ code
The pseudo code of the hash function is given as follows. int hash(const string &key) { int value = 1; for (int position = 0; position < max_key_length; position++) value *= key[position]; value %= hash_size; if (value < 0) value += hash_size; return value; } a. the hash function b. A constructor that takes an integer parameter specifying the hash table size (hash_size). c. The retrieve() method that takes a string key as the input and returns the location (index) of the key in the hash table. If the hash table does not have the key, retrieve() returns -1. d. The insert() method that takes a string key as the input and inserts it into the hash table. If the key already exists in the table or if the table is full, the insertion will not be completed and -1 is returned. If the key is inserted, the location (index) of the key in the hash table is returned. e. Class Hash_table1 uses linear probing for collision resolution. max width of the key is 6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started