home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!cl2.cl.uh.edu!csci11ba
- From: csci11ba@cl2.cl.uh.edu (451924952 NEWMAN, DANA FRANK)
- Subject: Re: reHASHing of Reserved Words
- Message-ID: <22AUG199211034860@cl2.cl.uh.edu>
- News-Software: VAX/VMS VNEWS 1.4-b1
- Sender: usenet@menudo.uh.edu (USENET News System)
- Nntp-Posting-Host: uhcl2.cl.uh.edu
- Reply-To: CSCI11BA@cl.uh.edu
- Organization: University of Houston - Clear Lake
- References: <2459.2a93e386@vger.nsu.edu>
- Date: Sat, 22 Aug 1992 17:03:00 GMT
- Lines: 46
-
- In article <2459.2a93e386@vger.nsu.edu>, g_harrison@vger.nsu.edu (George C. Harrison, Norfolk State University) writes...
- >I posted this about 10 days ago and had only ONE reply (which I appreciate but
- >was incorrect). I am SURE that someone in the Pasqual world knows the answer:
- >
- >I want a perfect hash function for strings of Pascal reserved words. A perfect
- >has function is a "simple function" normally using mod, div, length of string,
- >and Ord of some of the characters. I want such a function to map directly from
- >the 36 Pascal reserved words onto the numbers 0 .. 35 WITHOUT COLLISION.
- >
- >George
- >
- >George C. Harrison, Prof. of CS, Norfolk State University
- >g_harrison@vger.nsu.edu
- >
-
- Hash value (address) = Key length + Value(first char) + value(last char)
- where the table value is given by:
- A=11
- B=15
- C=1
- D=0
- E=0
- F=15
- G=3
- H=15
- I=13
- J=0
- K=0
- L=15
- M=15
- N=13
- O=0
- P=15
- Q=0
- R=14
- S=6
- T=6
- U=14
- V=10
- W=6
- X=0
- Y=13
- Z=0
-
- EXAMPLE: 'TO' = 2+6+0 = 8
-
-