home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / pascal / 4984 < prev    next >
Encoding:
Text File  |  1992-08-22  |  1.5 KB  |  61 lines

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