-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoubleHashing.hpp
53 lines (43 loc) · 1.08 KB
/
DoubleHashing.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
Lab 3 - Linear Probing, Quadratic Probing, and Double Hashing
CSC 255 Objects and Algorithms (Fall 2020)
Oakton Community College
Professor: Kamilla Murashkina
@file DoubleHashing.hpp
@author Russell Taylor
@date 9/9/20
*/
#ifndef DoubleHashing_hpp
#define DoubleHashing_hpp
#include "Hash.hpp"
template <typename Key, typename Value>
class DoubleHashing : public Hash<Key, Value> {
public:
/**
Constructor
@param initialSize the initial size of the hash table
@param doubleFactor factor R to be used in double hashing
*/
DoubleHashing(int initialSize, int doubleFactor);
/**
Destructor
*/
virtual ~DoubleHashing();
protected:
/**
Looks up a key in the hash table
@param key the key
@return the index of the key in the hash table
*/
virtual int lookUp(const Key& key);
private:
int doubleFactor;
/**
Hashes the key a second time
@param key the key
@return the hashed key
*/
int hash2(const Key& key);
};
#include "DoubleHashing-impl.hpp"
#endif /* DoubleHashing_hpp */