Does anyone know of a perfect hashing function for URLs with 64-bit integers that would perform well for most URLs?
It is impossible to create a perfect hash function if you don't know the set of keys that you will query in advance. If you know that, then you could use a something like gperf or cmph to generate the perfect hash function for you.
http://cmph.sourceforge.net/
I assume that a perfect hash function is not really what you want, so it suffices for you to use any reasonable hash function out there, like murmur hash or bob jenkins hash, with a hash table implementation, like __gnu_cxx::hash_map or dense_hash_map and sparse_hash_map from google.
http://code.google.com/p/google-sparsehash/ http://sites.google.com/site/murmurhash/ http://burtleburtle.net/bob/hash/doobs.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With