Python Forum
Efficiently find words
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Efficiently find words
#6
(Feb-07-2017, 07:34 PM)buran Wrote:
(Feb-07-2017, 07:16 PM)sumithar Wrote: that code while simpler didn't perform all that well
well - the itertools is optimized and provides functions for creating iterators for efficient looping. I don't see how it could be less efficient than your code. my snippets runs 15 mins to generate all permutations.
Sorry, didn't meant to say it was not as good or worse than my original effort! Just that it was still taking time. But as Ofnuts clarifies, your 2nd suggestion where I check to see if the 10 letter words in the words file (which in my case happens to be a mere 2000 or so) are made up of the same letters as the states is waaay more efficient. That's basically 2000 comparisons as it were.
My original effort and your modified approach using itertools were still doing 46x47x48x49x50 comparisons weren't they?
Reply


Messages In This Thread
Efficiently find words - by sumithar - Feb-07-2017, 04:21 PM
RE: Efficiently find words - by buran - Feb-07-2017, 04:41 PM
RE: Efficiently find words - by sumithar - Feb-07-2017, 07:16 PM
RE: Efficiently find words - by buran - Feb-07-2017, 07:34 PM
RE: Efficiently find words - by Ofnuts - Feb-07-2017, 10:15 PM
RE: Efficiently find words - by sumithar - Feb-08-2017, 01:29 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020