Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: Challenge: 8 Letters, Most Words

by aaron_baugher (Deacon)
on Oct 05, 2013 at 15:38 UTC ( #1057043=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Challenge: 8 Letters, Most Words
in thread Challenge: 8 Letters, Most Words

That should help, but even then it seems like it would be possible for some matches to be ignored with my method. For instance, say the word 'post' comes along, and next the word 'dime.' Since 'dime' can fit into the bucket started by 'post,' that bucket now holds 'postdime.' Later the word 'cot' comes along, and now it can't be added to that bucket, so there will be no bucket that ever contains 'post' and 'cot.'

As a test, I tried this short list of words: post dime coat tear. The three words "post coat tear" can fit into 8 letters: aceoprst. Mine failed to find that, as expected, because the 'post' bucket had already been filled with 'dime,' so 'coat' and 'tear' never got a chance at it. If I move 'dime' to the end, then it works, but there's no way to anticipate that. So my method fails, even if I sort the words by length first.

Aaron B.
Available for small or large Perl jobs; see my home node.


Comment on Re^5: Challenge: 8 Letters, Most Words
Re^6: Challenge: 8 Letters, Most Words
by hdb (Parson) on Oct 05, 2013 at 17:43 UTC

    Thanks for this post! It did not even occur to me that you could add another letter to make a word fit into a bucket or class if the total of 8 is not exhausted yet. Means I have to rework my solution. I am thinking of cloning a class with less than 8 letters when a new word is added that requires adding new letters. But this will create an explosion of possibilities and lengthen the runtime a lot. Not for tonight...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057043]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-08-02 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls