Re: Best way to hash a set of integers?



On Tue, 19 Sep 2006 23:46:11 +0000, Richard Heathfield
<invalid@xxxxxxxxxxxxxxx> wrote:

Digital Puer said:

<snip>

I guess I'm looking for a way to compute what could be
called a multi-dimensional key. Suppose I have three integers
representing age, height (in cm), and weight (in lbs).

What a bizarre mix of units! :-)

I believe that it is known as the annualized English metric system.


I want
to somehow combine those together into a single key that will be
my index into a hash table (prior to doing mod hash_table_size).

Have you tried simply adding the numbers? What sort of distribution do you
get?

Approximately normal.

An issue here that for which I would like runs as follows: Suppose we
have multi-dimensional data, e.g., dimensions age/height/weight.
Construct a hashing scheme such that we can extract all elements
having a given age (or weight or height).


.



Relevant Pages