Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!rpi!batcomputer!cornell!rochester!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Conventions and "tricks" used in Forth Message-ID: <1851.UUL1.3#5129@willett.pgh.pa.us> Date: 15 Oct 90 03:06:28 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 31 Date: 10-09-90 (09:26) Number: 4 of 10 To: RAY DUNCAN Refer#: NONE From: JONAH THOMAS Read: NO Subj: HASHING THE DICTIONARY Status: PUBLIC MESSAGE Conf: FORTH (58) Read Type: GENERAL (+) > use a 4 KB hash table and chain the collisions. We have found that > even with several thousand words in the dictionary, FIND only > requires an average of <2 name comparisons. OK! I was thinking about using a sort of binary tree and a comparison to cut the search time down to o[log2(n)] from o[n]. But it doubled the size of the links. With a 4K hash table you'd break even on size at about 2000 words, and it only gets better from there. With <2 comparisons you do better on time as soon as the dictionary gets big enough that a lot of string comparisons take longer than <2 hash compares. That might be fairly small. The only advantages left for the tree are the ease of thinking (which is a one-time thing) and re-use of the code (which is trivial). Thanks for stopping me before I actually wasted time getting it working! 8-) --- ~ NET/Mail : The MATRIX (5 Nodes/1.2 Gig) Birmingham, AL (205) 323-2016 ~ RNet 1.05M:* Metrolink - Front Porch BBS 404-695-1889 HST -Regional HUB PCRelay:DCINFO -> #16 MetroLink (tm) International Network 4.10 DC Info Exchange MetroLink International Hub ----- This message came from GEnie via willett through a semi-automated process. Report problems to: dwp@willett.pgh.pa.us or uunet!willett!dwp