Thread: Hash table determing load factor

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    31

    Hash table determing load factor

    I have a file that has 70k words in it. I am trying to determine how big my hashtable should be, I suspect it should be 75 to 80% of the file size (ex. 70000 x .75) If I make it that size, what sort of hash function would be appropriate for use? I am new to hashtables and wonder if I can just make a generic function based on ascii values in the strings, that way it can be completely spontaneous when they get inserted into a bucket. Please help guide me, thank you.

  2. #2
    Registered User
    Join Date
    Mar 2012
    Location
    the c - side
    Posts
    373
    Generally a load factor of 0.75 to 0.5 is recommended, which is where you might have got the 0.75 from.

    But load factor = The no. of data entries / Size of Hash Table.

    Which implies if you want a load factor of 0.75 you want a hash table of size 70,000 / 0.75 , or 93,000 - 94,000.

    On the hash function for strings - a quick google I'm sure will give you examples.

    Like this.
    Last edited by gemera; 03-14-2014 at 03:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hash table
    By mexx in forum C++ Programming
    Replies: 0
    Last Post: 06-30-2009, 12:23 PM
  2. hash table in C
    By -EquinoX- in forum C Programming
    Replies: 7
    Last Post: 03-25-2008, 09:16 PM
  3. Hash Table
    By Cpro in forum C++ Programming
    Replies: 3
    Last Post: 03-20-2008, 02:14 PM
  4. hash table!
    By spank in forum C Programming
    Replies: 4
    Last Post: 04-10-2006, 11:09 AM
  5. Hash table
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 01-14-2002, 07:06 PM