Storage mechanism using double-hashed keys.
More...
#include <iostream>
#include <memory>
#include <vector>
|
using | double_hashing::Entry = struct Entry |
|
|
int | double_hashing::notPresent |
|
std::vector< Entry > | double_hashing::table |
|
int | double_hashing::totalSize |
|
int | double_hashing::tomb = -1 |
|
int | double_hashing::size |
|
bool | double_hashing::rehashing |
|
Storage mechanism using double-hashed keys.
- Author
- achance6
-
Krishna Vedala
- Note
- The implementation can be optimized by using OOP style.
◆ main()
Main program
- Returns
- 0 on success
250 {
251 int cmd = 0,
hash = 0, key = 0;
252 std::cout <<
"Enter the initial size of Hash Table. = ";
255 bool loop = true;
256 while (loop) {
266 switch (cmd) {
267 case 1:
271 break;
272 case 2:
276 break;
277 case 3: {
281 if (entry.
key == double_hashing::notPresent) {
283 }
284 break;
285 }
286 case 4:
287 std::cout <<
"Enter element to generate hash = ";
291 break;
292 case 5:
294 break;
295 default:
296 loop = false;
297 break;
298
299 }
301 }
302 return 0;
303}
void * hash(const std::string &message)
Converts the string to bytestring and calls the main algorithm.
Definition md5.cpp:287
size_t hashFxn(int key)
Hash a key. Uses the STL library's std::hash() function.
Definition double_hash_hash_table.cpp:47
void display()
Definition double_hash_hash_table.cpp:143
void removalInfo(int key)
Definition double_hash_hash_table.cpp:227
int doubleHash(int key, bool searching)
Performs double hashing to resolve collisions.
Definition double_hash_hash_table.cpp:71
void addInfo(int key)
Definition double_hash_hash_table.cpp:212
Definition double_hash_hash_table.cpp:36
int key
key value
Definition double_hash_hash_table.cpp:38