unsigned point::hash() return round(x*101)*round(y*97) template <typename T> unsigned hash_table::hash(const T & e) return e.hash() % size
XOR 0 1 0 0 1 1 1 0
(x*101 ^ y*97) % B
.
(round(x*101)*round(y*97))/256 % B
.
(round(x*101)*round(y*97))/2 % B
.
unsigned point::random(double k) return (M*static_cast(k*11) + a) % s unsigned point::hash() return random(x)*random(y); template <typename T> unsigned hash_table(const T & e) return e.hash() % size
M = 25173
, a = 13849
, s = 65536
.
Tests | |||||||
1 | 2 | 3 | 4 | 5 | 6 | 7 | |
1 | |||||||
2 | |||||||
3 | |||||||
4 | |||||||
5 | |||||||
6 |
files | 3 | 5 | 5 | 7 | 6 | 5 | |
lines | 309 | 446 | 440 | 647 | 997 | 549 | |
semicolons | 122 | 152 | 181 | 234 | 321 | 207 |
// Assignment operator HashTable& operator=(const HashTable &) // Insert Function bool Insert(char*, char*, double, double) // Delete Function bool Delete(double, double) // Find Function bool Find(char*, char*, double, double, int &)