Question: Hello, I need help rehashing in a program I am writing in c++. This is my code that I have: template void HashTable ::rehash(size_t buckets)
Hello, I need help rehashing in a program I am writing in c++.
This is my code that I have:
templatevoid HashTable ::rehash(size_t buckets) { // Not sure what to put here. }
This is what I need it to do:
change the number of buckets in the hash table, and relocate items into the correct buckets // recommendation is to double the current number of buckets and add +1 (e.g., 511 -> 1023).
Any help would be appreciated!
This is in my private class:
private: std::size_t num_items_{0}; double max_load_factor_; std::hash key_hash_; float num_buckets() { return 0; } size_t num_buckets_; vector>> table; vector>> buckets_;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
