comp.lang.ada
 help / color / mirror / Atom feed
* function hash
@ 2001-05-27 22:07 Nacho Robledo
  2001-05-28  0:23 ` James Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nacho Robledo @ 2001-05-27 22:07 UTC (permalink / raw)


Hello !!!!!!

    I am a student of Computer Sciencie and i am looking for an easy  hash
function that can work with 15 o more characters... It's for working in a
table of 500-1000 elements. ANY idea?

Thanks !!!!!

--
--
 Ignacio Robledo Rosell
 mailto:rrilpm@arrakis.es
 http://zipi.fi.upm.es/~g990406
 ****************************************
 "When code matters more than comercials"
 ****************************************






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-27 22:07 function hash Nacho Robledo
@ 2001-05-28  0:23 ` James Rogers
  2001-05-28  6:47 ` Jeffrey Carter
  2001-05-28 17:04 ` Nacho Robledo
  2 siblings, 0 replies; 9+ messages in thread
From: James Rogers @ 2001-05-28  0:23 UTC (permalink / raw)


Nacho Robledo wrote:
> 
> Hello !!!!!!
> 
>     I am a student of Computer Sciencie and i am looking for an easy  hash
> function that can work with 15 o more characters... It's for working in a
> table of 500-1000 elements. ANY idea?
> 

You might find the package GNAT.HTable to be useful.

This package is included in the public GNAT distribution.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-27 22:07 function hash Nacho Robledo
  2001-05-28  0:23 ` James Rogers
@ 2001-05-28  6:47 ` Jeffrey Carter
  2001-05-30 20:48   ` Florian Weimer
  2001-05-28 17:04 ` Nacho Robledo
  2 siblings, 1 reply; 9+ messages in thread
From: Jeffrey Carter @ 2001-05-28  6:47 UTC (permalink / raw)


Nacho Robledo wrote:
> 
>     I am a student of Computer Sciencie and i am looking for an easy  hash
> function that can work with 15 o more characters... It's for working in a
> table of 500-1000 elements. ANY idea?

You might find the article "Fast Hashing of Variable-Length Text
Strings," by P. K. Pearson (CACM 1990 Jun) of interest. It describes a
fast "hashing function specifically tailored to variable-length text
strings."

An implementation of this function is part of the PragmAda Reusable
Components, available from

http://home.earthlink.net/~jrcarter010/pragmarc.htm

or from the mirror at www.adapower.com.

-- 
Jeff Carter
"Your mother was a hamster and your father smelt of elderberries."
Monty Python & the Holy Grail



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-27 22:07 function hash Nacho Robledo
  2001-05-28  0:23 ` James Rogers
  2001-05-28  6:47 ` Jeffrey Carter
@ 2001-05-28 17:04 ` Nacho Robledo
  2 siblings, 0 replies; 9+ messages in thread
From: Nacho Robledo @ 2001-05-28 17:04 UTC (permalink / raw)


Thank you very much !!!!! all the information is very
usefull ... thanks again

--
--
 Ignacio Robledo Rosell
 mailto:rrilpm@arrakis.es
 http://zipi.fi.upm.es/~g990406
 ****************************************
 "When code matters more than comercials"
 ****************************************






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-28  6:47 ` Jeffrey Carter
@ 2001-05-30 20:48   ` Florian Weimer
  2001-05-31  0:45     ` Jeffrey Carter
  2001-05-31  7:13     ` tmoran
  0 siblings, 2 replies; 9+ messages in thread
From: Florian Weimer @ 2001-05-30 20:48 UTC (permalink / raw)


Jeffrey Carter <jrcarter@acm.org> writes:

> You might find the article "Fast Hashing of Variable-Length Text
> Strings," by P. K. Pearson (CACM 1990 Jun) of interest. It describes a
> fast "hashing function specifically tailored to variable-length text
> strings."
> 
> An implementation of this function is part of the PragmAda Reusable
> Components, available from
> 
> http://home.earthlink.net/~jrcarter010/pragmarc.htm

A hash function returning only 256 different values?  Are there any
applications for it?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-30 20:48   ` Florian Weimer
@ 2001-05-31  0:45     ` Jeffrey Carter
  2001-05-31  7:22       ` Florian Weimer
  2001-05-31  7:13     ` tmoran
  1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey Carter @ 2001-05-31  0:45 UTC (permalink / raw)


Florian Weimer wrote:
> 
> A hash function returning only 256 different values?  Are there any
> applications for it?

Given the original poster's requirements of handling 500-1000 elements,
that's only 2-4 per bin, so it seemed suitable.

-- 
Jeff Carter
"We call your door-opening request a silly thing."
Monty Python & the Holy Grail



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-30 20:48   ` Florian Weimer
  2001-05-31  0:45     ` Jeffrey Carter
@ 2001-05-31  7:13     ` tmoran
  1 sibling, 0 replies; 9+ messages in thread
From: tmoran @ 2001-05-31  7:13 UTC (permalink / raw)


>A hash function returning only 256 different values?  Are there any
>applications for it?
  Anytime cutting the size of a search by a factor of 256 seems useful.
Or a cheap test to see whether it's worth an expensive comparison to
check for a match with one of a few objects.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-31  0:45     ` Jeffrey Carter
@ 2001-05-31  7:22       ` Florian Weimer
  2001-05-31 19:21         ` Simon Wright
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2001-05-31  7:22 UTC (permalink / raw)


Jeffrey Carter <jrcarter@acm.org> writes:

> Florian Weimer wrote:
> > 
> > A hash function returning only 256 different values?  Are there any
> > applications for it?
> 
> Given the original poster's requirements of handling 500-1000 elements,
> that's only 2-4 per bin, so it seemed suitable.

In particular with long strings, this will result in a measurable
performance degradation in comparison to a real hash function because
of the necessity to perform additional key comparisons.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: function hash
  2001-05-31  7:22       ` Florian Weimer
@ 2001-05-31 19:21         ` Simon Wright
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Wright @ 2001-05-31 19:21 UTC (permalink / raw)


Florian Weimer <fw@deneb.enyo.de> writes:

> Jeffrey Carter <jrcarter@acm.org> writes:
> 
> > Florian Weimer wrote:
> > > 
> > > A hash function returning only 256 different values?  Are there any
> > > applications for it?
> > 
> > Given the original poster's requirements of handling 500-1000 elements,
> > that's only 2-4 per bin, so it seemed suitable.
> 
> In particular with long strings, this will result in a measurable
> performance degradation in comparison to a real hash function because
> of the necessity to perform additional key comparisons.

I don't understand. If there are only 256 bins (not unreasonable) then
there are *bound* to be collisions for a large key space (eg all the
sentences in Jane Eyre).

If you need a perfect hash (eg for the reserved words in Ada) that's
quite a different problem.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-05-31 19:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-27 22:07 function hash Nacho Robledo
2001-05-28  0:23 ` James Rogers
2001-05-28  6:47 ` Jeffrey Carter
2001-05-30 20:48   ` Florian Weimer
2001-05-31  0:45     ` Jeffrey Carter
2001-05-31  7:22       ` Florian Weimer
2001-05-31 19:21         ` Simon Wright
2001-05-31  7:13     ` tmoran
2001-05-28 17:04 ` Nacho Robledo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox