On 2 Feb 2010, at 03:05, Richard O'Keefe wrote:
A simple hash-function for strings is to simply exclusive-or the
bytes and then reduce modulo a prime number,
Simply exclusive-oring the bytes will give you at most 256 distinct
results. (For an ASCII source, 128 distinct results.) After
On Feb 1, 2010, at 9:04 AM, Hans Aberg wrote:
A simple hash-function for strings is to simply exclusive-or the
bytes and then reduce modulo a prime number,
Simply exclusive-oring the bytes will give you at most 256 distinct
results. (For an ASCII source, 128 distinct results.) After that,
On Fri, Jan 29, 2010 at 9:26 AM, Hans Aberg hab...@math.su.se wrote:
On 29 Jan 2010, at 15:57, John Lato wrote:
Are you
basically just suggesting to stick everything in an array with the key
as an index?
You still need to fold the key values onto some interval.
Not with a suitably large
On 31 Jan 2010, at 20:07, John Lato wrote:
Or are you suggesting an actual hash table?
The hash function folds the keys onto an interval. Since you have
Int values
k, you might just use a mod k n function for that.
If it's the
latter, I'm not certain where the array fits into the
From: Hans Aberg hab...@math.su.se
On 28 Jan 2010, at 20:07, Steve Schafer wrote:
The data are currently in a large lookup table. To save space, I'd
like
to convert that into a sort of hash function:
hash :: key - value
My question is this: Is there any kind of generic approach that can
On 29 Jan 2010, at 12:52, John Lato wrote:
There are minimal perfect hash functions; there are some libraries
mentioned here, though they are not in Haskell code:
http://en.wikipedia.org/wiki/Perfect_hash_function
This is suitable when you do a lot of lookups with few key updates.
An
On Fri, Jan 29, 2010 at 12:46 PM, Hans Aberg hab...@math.su.se wrote:
On 29 Jan 2010, at 12:52, John Lato wrote:
There are minimal perfect hash functions; there are some libraries
mentioned here, though they are not in Haskell code:
http://en.wikipedia.org/wiki/Perfect_hash_function
This
On 29 Jan 2010, at 15:57, John Lato wrote:
That looks interesting too. Yet another idea: use arrays
http://haskell.org/haskellwiki/Arrays
Then build a hash table, say just taking mod k n, and have values
in some
lookup map. If n set of keys, average time complexity is O(1),
and arrays
I'm looking for some algorithmic suggestions:
I have a set of several hundred key/value pairs. The keys are 32-bit
integers, and are all distinct. The values are also integers, but the
number of values is small (only six in my current problem). So,
obviously, several keys map to the same value.
On 28 Jan 2010, at 20:07, Steve Schafer wrote:
The data are currently in a large lookup table. To save space, I'd
like
to convert that into a sort of hash function:
hash :: key - value
My question is this: Is there any kind of generic approach that can
make
use of the knowledge about the
10 matches
Mail list logo