Thread: hash tables: multiplicative method with non-binary keys

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    16

    hash tables: multiplicative method with non-binary keys

    I'm trying to create a hash table and use the multiplicative method as a collision resolution. Our convention for the conversion of string data to numeric key is: a=01, b=02, c=03... So if the input to the table is "easy", the corresponding numeric key is 05011925 or 5011925. I've done research on the multiplicative method for collision resolution, but all sources present the process with the assumption that the numeric key is expressed in binary digits. The problem is we haven't covered bitwise operations. The help I need from you is in "translating" the following statements (which explains multiplicative method with binary numeric keys) into statements which explains the process on non-binary keys i.e. without the bitwise operations which we haven't covered yet.
    The process is as follows:
    1. Set all bits to the left of the imaginary radix point (of the binary key) to zero.
    2. Shift left p bits (where p is log to base 2 of the size of the table) e.g. shift left 5 bits if the size of the table is 32.
    3. Set the rightmost of the p bits to 1 (to make sure that h(k) is odd).
    Last edited by chickenandfries; 03-28-2008 at 11:15 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with hash tables with direct chaining
    By agentsmith in forum C Programming
    Replies: 4
    Last Post: 01-05-2008, 04:19 AM
  2. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2007, 11:36 PM
  3. best STL method to implement a binary tree
    By MatthewDoucette in forum C++ Programming
    Replies: 8
    Last Post: 06-16-2006, 07:08 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Help with beginning hash tables, please.
    By Will in forum C++ Programming
    Replies: 8
    Last Post: 11-17-2002, 09:51 PM