[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] A heftier challenge for y'all




A while back on clp.moderated this one was discussed, as some of you
may recall.  It will take more than five minutes to solve.  ;-)

You've probably seen the word puzzles that involve transforming one
word into another by changing one letter at a time, e.g. 'solar' into
'oasis' in 12 steps (single-letter changes).  Considering the words of
a lexicon as nodes, and single-letter changes between pairs of words
as edges, the general problem is to find all the graphs; each graph
is a network of words which can be transformed into each other in
some number of steps.  The distance between any two words in a graph
is the number of changes required to transform one into the other.
If there is more than one path -- as there will be, for example, if
there are any cycles in the graph -- then for the purposes of this
puzzle we only consider the shortest one.  So, in general, for any
two words in the lexicon, if there is a "shortest path distance" between
them -- or no path at all.  The specific problem, then, is this: to find
the pair of words with the *longest* such "shortest path".

Of course, you can consider words of length 6 instead; you may even wish
to make this number parametric to your program.

You have 5 minutes. Good luck!  ;-)

John Porter



==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe