Hash Table algorithm

This is a discussion on Hash Table algorithm within the C Programming forums, part of the General Programming Boards category; Hi, I'm currently implementing a hash table algorithm. For hashing I used the FVN algorithm ( http://www.isthe.com/chongo/tech/comp/fnv/ . But now ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    13

    Hash Table algorithm

    Hi,
    I'm currently implementing a hash table algorithm. For hashing I used the FVN algorithm (http://www.isthe.com/chongo/tech/comp/fnv/. But now I'm asking myself to store/order them effective. I read about spiral, linear and bucket storage. But what's the fastest? Are there other storage algorithms?

    thanks
    matott

  2. #2
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    mm...when i try to use it i get an error that longlong.h is not found.

    i'd help with your storage problems, but your better off with it than i :-[ lol
    Registered Linux User #380033. Be counted: http://counter.li.org

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    13
    Code:
    #include <stddef.h>
    #include <stdint.h>
    
    uint32_t hash_algorithm_fvn (void *data, size_t size)
    {
    register char *a;
    register uint32_t hash;
    
    a = (char *) data;
    
    for (hash = 0; a <= data + size; ++a)
            {
            /* hash *= 16777619; */
            hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
            hash ^= *a;
            }
    
    return hash;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dictionary in C# to hash table in C?
    By dinoman in forum C Programming
    Replies: 2
    Last Post: 04-12-2009, 09:23 PM
  2. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  3. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2007, 11:36 PM
  4. Hash table creation and insertion
    By tgshah in forum C Programming
    Replies: 1
    Last Post: 01-23-2006, 06:54 PM
  5. Not sure on hash table memory allocations
    By Thumper333 in forum C Programming
    Replies: 3
    Last Post: 09-27-2004, 09:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21