comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: Hashing Algorithms
Date: 1996/03/25
Date: 1996-03-25T00:00:00+00:00	[thread overview]
Message-ID: <4j72g2$lbn@watnews1.watson.ibm.com> (raw)
In-Reply-To: internews46B4920C5E@argonet.co.uk

In article <internews46B4920C5E@argonet.co.uk>, David Wallace
<averon@argonet.co.uk> writes: 

|> Ia working currently with a Design Issue which requiresbthe use of a hashing
|> algorithm for a string to an integer.
|>
|> I have seen a couple of algorithms, however due to their nature would not be
|> allowed to incorporate them in to the software.

Does "due to their nature" mean "due to the fact that they use unchecked
conversion"?

|> Could anybody point out the source of some hashing algorithms, which are
|> quick and do not use unchecked conversion within them. If not, I will just have
|> to reinvent the wheel and write one myself.

1. If your goal is to treat a character as a numeric value, you don't
   need unchecked conversion.  Just use Character'Pos.

2. I think I smell a silly coding rule.  While unchecked conversion,
   should, in general, be used with caution, there are circumstances in
   which its use is appropriate and perhaps even unavoidable.  For
   example, if you were building a hash table of trees to ensure that
   there is a unique copy of each subtree ever constructed, it would be
   appropriate to hash access values pointing to tree nodes by
   uncheckedly converting them to some integer type.

--
Norman H. Cohen    ncohen@watson.ibm.com




  parent reply	other threads:[~1996-03-25  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-25  0:00 Hashing Algorithms David Wallace
1996-03-25  0:00 ` Robert Dewar
1996-03-25  0:00 ` Norman H. Cohen [this message]
1996-03-25  0:00   ` Robert A Duff
replies disabled

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