I'm doing this "double hashing" because I have to implement
a HashTable for both
Java and C/C++. C/C++ environment does not support e.g. STL so, I can not use STL and Java's Hashtable class and it's methods
(or actually try to port in into C/C++) to make code that look same in both Java and C/C++ versions. That is the reason why I have to code it without
any classlibrary support.
I read from the book by Mark Allen Weiss (Data Structures and
Algorithm Analysin in Java) that in double hashing there are two hashing functions. The second hashing function should have rules below:
- HashTable size should be prime (count of buckets)
- Hash2 function could be following: Hash2(x) = R - (x mod R), with R a prime smaller than tablesize (count of buckets)
So, what I don't actually know is that if my key to HashTable is e.g. URL
string and I'm saving www pages into that HashTable, how should I calculate
key from URL like
http://localhost/mypage.html? That's why I'm interested in it.
So, if some one have code snippets or somethig that calculates
hashvalue using double hashing using Java(without using "too much" Java's Collection API) or C I'm very interested in it.
Thanks!