Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3file with code.Please Follow Hashtable.cpp main.cpp and hastable.h!! Create a template class for hashtable. If the user does not specify a size in the constructor
3file with code.Please Follow
Hashtable.cpp
main.cpp
and hastable.h!!
Create a template class for hashtable. If the user does not specify a size in the constructor then the default size of 20 will be used. In each slot you store a linkedlist of key-value pairs. The put function is responsible to get a key-value pair and put that pair in the likedlist located in the index of key%size. The get function receives a key and returns a value. If the number of inserted elements to the hashtable become larger than 75% of the size then the rehash function will be called, that creates a hashtable with a larger size (Double times larger) and put all the key-value pairs of t he old table in the new table. If the number of elements in the linked list located in the hash bucket be 8 or greater than 8 then the linked list will be converted to a binary search tree (After you learned about balanced binary search trees, you can change to that data structure). The remove function accepts a key and removes the key-value pair. If the number of elements be 6 or smaller than 6 then the tree should be converted to a linked list. You need to have function size which returns the size of the tableStep 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