![]() |
Designing a Hash Function
Brand new here, so hello, and now onto why I'm here:
For a Comp-Sci class, we have to design a hash table and function to sort 10,000+ English Words into an array, with 9,000-16,000 elements in the Hash Table, using chaining to handle collisions. But coming up with a good Hash Function is proving rather difficult. Right now I can get a load factor of about .71, but the higher that number goes, the more marks I get, so all suggestions are appreciated :D |
Welcome to the forums. Please take a moment to read the FAQ/rules and possibly a "How to Post..." thread, just to get the feel of the community.
|
Well, since my regular folding doesn't seem to be working too spectacularly for me, does anyone know a way to take the ASCII value for more than one char, and use bitwise operations to fold it, like in Encryption algorithms?
|
Quote:
|
>But coming up with a good Hash Function is proving rather difficult.
Duh. A lot of brain cells have met their untimely demise trying to come up with a good hash function. It's not easy, and I say that from the standpoint of working for a long time and only coming up with only *one* algorithm suitable for use in a hash table. It's usually better to take an existing hash function and work from there. This has a list of good (and bad) functions that you can look at and fit to your needs. |
Quote:
|
| All times are GMT -5. The time now is 9:16 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC