![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
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 ![]() |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
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?
|
|
|
|
|
|
#4 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#5 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 4
![]() |
>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.
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#6 | |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|