2 Replies - 1257 Views - Last Post: 17 November 2012 - 01:29 PM Rate Topic: -----

#1 andre1011  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 87
  • Joined: 12-January 11

chained hashing of integers C++

Posted 17 November 2012 - 08:34 AM

Hello everyone, I am looking for a systematic approach to hash random numbers (0 to 200) into an array of 70 elements, evenly distributed if possible. So far I have tried key % 70 but this expression does not use up all 70 elements.
Is This A Good Question/Topic? 0
  • +

Replies To: chained hashing of integers C++

#2 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1074
  • View blog
  • Posts: 4,533
  • Joined: 09-June 09

Re: chained hashing of integers C++

Posted 17 November 2012 - 12:24 PM

Quote

So far I have tried key % 70 but this expression does not use up all 70 elements.

This hash function should undoubtably fill up a 70 element array if your hashing 0 - 200. Can you post what you have tried so far?
Was This Post Helpful? 0
  • +
  • -

#3 marty617  Icon User is offline

  • New D.I.C Head

Reputation: 7
  • View blog
  • Posts: 33
  • Joined: 14-October 12

Re: chained hashing of integers C++

Posted 17 November 2012 - 01:29 PM

If it is not filling up then it is only because you are probably not adding enough entries to need every position.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1