From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eec376a334ad59ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-15 08:35:35 PST Message-ID: <3CBAF2A7.7D819DD8@sympatico.ca> From: Ken Burtch X-Mailer: Mozilla 4.77 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: hashing References: <604t8.3744$tZ1.983158@news2-win.server.ntlworld.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 15 Apr 2002 11:32:55 -0400 NNTP-Posting-Host: 64.229.185.253 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1018884820 64.229.185.253 (Mon, 15 Apr 2002 11:33:40 EDT) NNTP-Posting-Date: Mon, 15 Apr 2002 11:33:40 EDT Organization: Bell Sympatico Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:22558 Date: 2002-04-15T11:32:55-04:00 List-Id: I believe there's a simple string hash value generator (HashOf) included in the strings package of my drawtools suite http://www.pegasoft.ca Ken B. "chris.danx" wrote: > > "Steven Deller" wrote in message > news:mailman.1018477621.31315.comp.lang.ada@ada.eu.org... > > > Subject: hashing > > > Hi, > > > > > > Does anyone have a good hash function for strings (length is > > > arbitary, number of buckets is determined when package is > > I'll maybe look into that (if it doesn't involve reverse engineering C). I > found one that may suffice for the purposes of the exercise, it's nothing > fancy but it should work. > > Sum all ascii vals of chars in string, then take modulo bucket size. > > > Other than that, I'd try one of the numerous ISO-defined hash functions, > > such as CRC-32, etc. > > ISO define hash functions? > > > I did a web search on "hash function algorithms" and came up with > > NUMEROUS interesting sites. > > oops wrong search string, "hash function strings". Got loads of stuff in > code, but code is not as useful. Algorithm/function descriptions > (mathematics included) are better than code IMO, since they express > algorithms functions in a programming language independant manner. When we > were learning about bstrees they gave us Ada code which made no sense at the > time due to poor descriptions of the algorithms and considerations involved. > However when we learned how to do bstrees in Haskell, just before easter > break it made perfect sense since the lecturer took the time to describe the > algorithms. The code was secondary to the algorithm. > > [snip] > > > > p.p.s. should performance/complexity information be included? > > > I seem to recall a conversation on this a while back, but > > > can't remember if ppl thought it was a good idea. > > > > Complexity information always raises its head at some point. Best to > > include it. > > it does makes sense to include it and it'll definitely go in the gmgpl > version... But does complexity information come under the header of an > implementation detail? i don't think it does but if it does and I include > it in the spec, my tutor might disagree and I'll get penalised. This is one > of my grumps about uni, not knowing what they want with things. In first > year, you'd get penalised for *not* putting pointless comments in. > > Ignore that, I'm probably worrying about nothing!!! > > Thanks, > Chris -- Ken O. Burtch: http://www.pegasoft.ca : Pegasoft System Manager in a Box / Business Shell : R.R.#1 Bio: 36;Bsc,UI,Lang,Games;Toons,Elves,SF,Pizza;Xian : Jordan Station, ON ``````````````````````````````````````````````````````` Canada L0R 1S0