Question: C++ Suppose that I have a hash table data[CAPACITY]. The hash table uses open addressing with linear probing. The table size is a global constant
C++ Suppose that I have a hash table data[CAPACITY]. The hash table uses open addressing with linear probing. The table size is a global constant called CAPACITY. Locations of the table that have NEVER been used will contain the key -1. All valid keys will be non-negative, and the hash function is: int hash_function(int key) { return (key % CAPACITY); } Complete the implementation of the following functions. There is no need to check the precondition, but your code must be as efficient as possible. Implement the following functions. const int CAPACITY = 10;
void initTable(int data[]);//
void printTable(int data[]);
int hash_function(int key);
void hashInsert(int data[], int key);
bool key_occurs(int data[], int search_key);
Part 1: Insert keys {10, 22, 11, 31, 24, 88, 38, 21} into an empty hash table with CAPACITY = 10 using QUADRATIC probing (c1=0 and c2=1) to resolve collision.
Part 2: Check whether following numbers (11, 31, and 23) are in the table.
SAMPLE:
Part 1: Hash table
10 11 22 -1 24 31 -1 21 88 38
Par 2: Checking numbers in the hash table
11 is found
31 is found
23 is not found
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
