Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Been working on a brain-twisting palindrome problem, where I get a word list and need to generate palindromes from it

    I take it that it must be more complex than just doing reverse() on the string. Or did you mean anagram?

    • Re:reverse? (Score:5, Informative)

      reverse is an easy way to test whether a provided value is a palindrome, but he asked about generating palindromes.

      Taking the work list and making a reversed copy is only a small part of generation. For example, if you happen to choose the word "top" as a starting point, the reversed word list can be used to check possible tail ends for a palindrome ("t" doesn't work, "ot" doesn't work, "pot" is a candidate); but that is insufficient, since it doesn't find longer words that end in pot as additional candid

      • Re:reverse? (Score:2, Insightful)

        by chaoticset (2105) on 2003.10.05 8:48 (#24666) Homepage Journal
        It's the generation that's the hard part, yes.

        I'm trying to focus on the "what word to start with" part (because I think that the right beginning is probably the trick here), and for some reason or other I figured it might be a good idea to start with the pivot point and move outward from there. I'm starting to think that a process where possible pivot points are identified, and possible end points are identified, and then guessing ensues from there would be better than trying to grow off the pivot point, but I keep feeling like there's got to be a better way to do it.

        So far, the basic analysis stuff I'm doing will, by my estimates, take 10 hours to run on the actual full wordlist, so I'm starting to work with a much smaller subset of that, less than 1/10th, and figure once I've got interesting results from that I'll run it on the full data and leave it overnight.

        Any hints/modules/insights available from anyone are welcome.

        --

        ------------------------------
        You are what you think.