Write an algorithm to solve word ladders such as
Word Meld 1 or
Word Meld 2. Input consists of the
starting and ending words and the maximum number of steps allowed. Available are files containing lists of
words of any given length; call one such file, say WORDS5.TXT containing a list of words of 5 letters each, and so on.
(In reply to
re: Finding adjacent words by SilverKnight)
Reading Bruce's comment, it does seem that it refers to how to implement what you describe as "the trivial function and class: FindAdjacentWords(GivenWord)", in that to implement this, one should not search the word list and check to see if each word is adjacent to the latest on your tree, but rather to find all 25N letter combinations that are adjacent, and check to see if they are words or not.
He's not referring to a pre-prepared list of adjacencies, but rather merely that the list of words themselves be sorted so as to be available for a binary search.
In fact, I've added this modified version to the solution that will be posted eventually, and it does speed the processing.
Edited on September 26, 2003, 11:53 am
|
Posted by Charlie
on 2003-09-26 11:51:23 |