home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / rec / puzzles / 8504 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  2.9 KB

  1. Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!grue
  2. From: grue@cs.uq.oz.au (Pauli)
  3. Newsgroups: rec.puzzles
  4. Subject: Re: Computer Dictionary Searches
  5. Message-ID: <11812@uqcspe.cs.uq.oz.au>
  6. Date: 22 Jan 93 02:58:40 GMT
  7. References: <1993Jan20.185756.16017@njitgw.njit.edu> <11811@uqcspe.cs.uq.oz.au>
  8. Sender: news@cs.uq.oz.au
  9. Reply-To: grue@cs.uq.oz.au
  10. Lines: 57
  11.  
  12. warwick@cs.uq.oz.au (Warwick Allison) writes:
  13.  
  14. >jpk2581@hertz.njit.edu (joseph p kisenwether apmt stnt) writes:
  15.  
  16. >>I am trying to create some original word puzzles and need to find 
  17. >>words with certain characteristsics:
  18. >>For example
  19. >> two words of more than ten letters which differ by only one 
  20. >>stictly internal letter such that there exist two other letter
  21. >>(one to the left and one to the right) such that in word one
  22. >>there exists no sub-word containing both the changable letter 
  23. >>and the one to the left while in word two there exists no sub-word 
  24. >>conatining both the changable letter and the one to the right.
  25.  
  26. Very complex problem.  The expensive bit will be the finding of the pairs
  27. of ten letter words.  The testing if something is a word is very very fast
  28. if you follow the scheme Warwick proposes.  Even better you can precompute
  29. most of this stuff.  Keep a table of 10 letter words and the positions where
  30. the changable letter satisfies the condition for left and right.  My word
  31. list contains about 40000 10 letter words, so this isn't too excessive a task.
  32.  
  33.  
  34. >>c) what the format is so that I can right the appropriate search 
  35. >>    program
  36.  
  37. >A Trie.  You could use a DAWG, but we (Paul Dale & I) have found that
  38. >a Trie is better, because you can store suplementary data for arcs
  39. >in the tree.
  40.  
  41. The dictionary comes in plain text.  A DAWG or Trie happens to be a very
  42. efficient way of searching for words given some constraints (which can
  43. be quite general) or for determining if this word is really a word (complexity
  44. is O(length of word) with a small constant multiplier, which should be as good
  45. as a hash table).
  46.  
  47. Interestingly, the construction of a Trie from a plain text word list is
  48. O(length of word list) and conversion from that to a DAWG is O(n log n) where
  49. n is the number of nodes in the Trie.  This does assume that you have plenty
  50. of space to hold intermediate structures before you pack everything down.
  51.  
  52. I've also implemented a best of both worlds approach:  A DAWG containing the
  53. bulk of the word list and a secondary Trie that details additions/deletions
  54. from the DAWG.  This gives the space savings of a DAWG with the editing
  55. facilities of a Trie.  It doesn't allow data to be tagged with every word
  56. like a pure Trie would.
  57.  
  58.  
  59.  
  60.                                 Pauli
  61.  
  62. Paul Dale                       | grue@cs.uq.oz.au
  63. Department of Computer Science  | +61 7 365 2445
  64. University of Queensland        |
  65. Australia, 4072                 | Did you know that there are 41 two letter
  66.                                 |     words containing the letter 'a'?
  67.  
  68. --
  69.