Implement a HashTable for integers using open hashing to represent sets of integers. You must implement the hash table yourself and are not allowed to use the C++ standard template library, i.e. you will need to implement a class for the set. Your set must provide the basic set operations as discussed in class (add, delete, search, show, quit). Each element of the set will be stored in a node object, i.e. you will need a separate class that handles the nodes.

Upon starting your program, it will display the following prompt: set> (followed by a space):

set>

The user can then add, delete, search, or show the set. If the element is already in the set, then you need to create an error message.

Your hash table will have B=7 buckets and your hash function is h(x) = x^2 mod B.

FUNCTION DETAILS:

add will insert a number into the set and is followed by the prompt. If the element is already in the set, provide an informational message WARNING: duplicate input: #.

set> add 7
set> add 7
WARNING: duplicate input: 7
set> add 3
set>

delete will delete an element, if it is in the set. If the element does not exist, provide an informational message WARNING: target value not found: #.

set> delete 3
set> delete 8
WARNING: target value not found: 8
set>

search will return true or false to indicate if the element has been found

set> search 7
true
set> search 4
false
set>

show will list all the elements of the hash table in the following form:

set> show
()-()-()-()-()-()-()
set>

The parenthesis will contain the elements of the individual buckets, separated by commas. The above example is the empty set Assume the hash table contains the following elements (order of insertion matters, since elements are appended at the end of a list for each bucket)

set> add 1
set> add 2
set> add 3
set> add 4
set> add 5
set> add 6
set> add 7
set> show
(7)-(1,6)-(3,4)-()-(2,5)-()-()
set>

quit will exit the program

set> quit

For this assignment, you must make your hash table "fool-proof", i.e. implement error checking. Each error output must start with “Error!” Followed by an appropriate message. Adequate comments

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.