From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: Ada.Containers Hash function for a set of small integers
Date: Thu, 22 Apr 2010 21:39:46 -0400
Date: 2010-04-22T21:39:46-04:00 [thread overview]
Message-ID: <nospam-8771B2.21394622042010@news.aioe.org> (raw)
In-Reply-To: 50701baa-7c05-450c-a42d-c699516ddc00@t14g2000prm.googlegroups.com
In article
<50701baa-7c05-450c-a42d-c699516ddc00@t14g2000prm.googlegroups.com>,
Michael R <michael@zanyblue.com> wrote:
> Hi Folks,
>
> I'd like to use the generic Hashed_Maps container to store mappings
> from a set of small integers (three) to Wide_Strings
> (Indefinite_Hashed_Maps):
>
> (1, 10, 4) => "ABC",
> (10, 3, 5) => "XYZ",
>
> Does anyone have recommendations on how best to implement the Hash
> function for keys like this?
I'd try something simple like shift and add, but it might depend on the
definition of "small".
Whatever you decide, here's some code I used to examine the distribution
of collisions in a map keyed by "/usr/share/dict/words":
$ ./collisions
0: 218586 (55.59%)
1: 126250 (32.10%)
2: 38432 (9.77%)
3: 8362 (2.13%)
4: 1354 (0.34%)
5: 229 (0.06%)
6: 24 (0.01%)
7: 4 (0.00%)
8: 1 (0.00%)
<http://home.roadrunner.com/~jbmatthews/jumble.html#sec2>
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
next prev parent reply other threads:[~2010-04-23 1:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 23:26 Ada.Containers Hash function for a set of small integers Michael R
2010-04-23 1:39 ` John B. Matthews [this message]
2010-04-23 21:39 ` Simon Wright
2010-04-23 22:47 ` Michael R
2010-04-24 11:28 ` Simon Wright
2010-04-26 18:37 ` Robert A Duff
2010-04-26 21:05 ` Simon Wright
2010-04-26 21:50 ` Adam Beneschan
2010-04-27 4:50 ` AdaMagica
2010-04-27 19:04 ` Simon Wright
2010-04-27 19:08 ` Simon Wright
2010-04-23 23:08 ` Jeffrey R. Carter
2010-04-26 15:33 ` Warren
2010-04-26 18:14 ` Jeffrey R. Carter
2010-04-26 18:32 ` Charmed Snark
2010-05-05 4:29 ` Yannick Duchêne (Hibou57)
2010-05-06 15:46 ` Warren
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox