Write a program in C/C++ that reads N number of nonnegative decimal numbers from a user and creates a hash table to store the numbers. The output of the program displays the order of the numbers in the hash table. The program then prompts the user to enter a target value. The program searches the target value to the hash table, and displays the search outcome. For simplicity, let’s assume that N = 6 and the size of the hash table is 10. Use this hash function in your code h(k) = 2k+3 where k is the key value. Use linear probe method for collision resolution. Example test run Test Run 1: Enter 6 elements: 3 2 9 6 11 13 Hash table order: 13 9 - - - 6 11 2 - 3 Enter the target: 11 11 is located at index: 6 Test Run 2: Enter 6 elements: 3 2 9 6 11 13 Hash table order: 13 9 - - - 6 11 2 - 3 Enter the target: 15 15 is not in the table
Write a
For simplicity, let’s assume that N = 6 and the size of the hash table is 10. Use this hash function in your code h(k) = 2k+3 where k is the key value. Use linear probe method for collision resolution.
Example test run
Test Run 1:
Enter 6 elements: 3 2 9 6 11 13
Hash table order: 13 9 - - - 6 11 2 - 3
Enter the target: 11
11 is located at index: 6
Test Run 2:
Enter 6 elements: 3 2 9 6 11 13
Hash table order: 13 9 - - - 6 11 2 - 3
Enter the target: 15
15 is not in the table

Step by step
Solved in 2 steps with 1 images









