hash function - multiplication method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user4592357
    New Member
    • Mar 2017
    • 3

    hash function - multiplication method

    i'm reading cormen's algorithms book (3rd edition), hash functions. the division method is clear (key % m), but there's something i don't understand in multiplication method (page 263-264). the example is on page 264.

    here is a reference http://lcm.csa.iisc.ernet.in/dsa/node44.html

    the formula is: r1 * 2^w + r0
    on the example they get: r1=76300, r0=17612864

    i understand how the calculations are done, but i don't get why h(k) is 67. it says h(k) should be the 14 (p=14) most significant bits of r0.

    17612864 = 100001100110000 0001000000

    when i take the first 14 bits, i get 8600 in decimal
    when i take the last 14 bits, i get 64 in decimal

    but the h(k) found in example is 67. what am i doing wrong?
    Attached Files
Working...