Question
Please code the following on Visual Studio in C++ Implement a Contacts Database Table using Hashtable. Key Name Primary Contact Secondary Contact Address 1 Annie
Please code the following on Visual Studio in C++
Implement a Contacts Database Table using Hashtable.
Key | Name | Primary Contact | Secondary Contact | Address |
1 | Annie | +54216451351 | 54216451351 |
|
2 | john | +64532165543 | 4312321-5475 |
|
3 | mike | 123456789564 | 654121434-5084 |
|
Implement a class hashtable to store the above table. Use the contacts name to generate a Key, on which the record will be inserted in hashtable. This database should also have add/delete and search functionalities.
Details Hashtable will be of fixed length 10. Users can enter as many numbers as they desire. Each number will be stored in the form a node.
Users name will be used for generating key. On the base of key it will map to some position(0-9) on hashtable. The key generation function should fulfil the properties of a good hashing function. If more than one records map on same location then chaining should be used for removing this conflict.
Requirements
The following basic/core functions are required to be implemented. Any further implementation required to compete the operations of the following functions becomes mandatory.
1. A structure Node for storing contact info (key, name, primary_contact, secondary_contact, address)
2. Hash table Class
a. Insert Use the hashing function to insert records in hashtable. If hash function maps a record on some table index which is already filled then use chaining to insert that record(node).
b. Delete It should delete a specific record from hashtable based on name. Handle the feature to delete records that exist with same name(introduce some extra attribute in node that mark each record differentiable)
c. Search It should return all the data related to Contact/Contacts based on name/ (extra attribute that you introduce in node). Search way should be optimized, find records in O(n). You can use any way for doing this an extra attribute or whatever you like.
0 Node Node 1 FII 114 2 3 4 Node Node 5 6 6 AAAA 7 8 9 Node Node Hash table storing contact nodesStep 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