anonymous
  • anonymous
I am trying ps 6 and I am stuck in problem 4. I don't know how to find all the subset of a string, can anyone tell me?
MIT 6.00 Intro Computer Science (OCW)
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

maitre_kaio
  • maitre_kaio
When I read that question, I was a bit afraid too. Then I thought that this problem had probably been solved by someone else. And I was right: in Python, you can use the itertools library to solve this kind of problems: http://docs.python.org/library/itertools.html#module-itertools And that's how I used it: http://pastebin.com/L42X6DP6
anonymous
  • anonymous
Thank you maitre_kaio
anonymous
  • anonymous
i just found another cool one, it is hard to parse but it looks like implements the algorithm listed in the wikipedia powerset entry http://dpaste.com/694742/

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
Is it the point to just find a tool that does the work you want?How deeply should you understand how each works? I cannot tell from the pset wording.Seems you could just find an example or previous tool/module to do whatever you like without really knowing the innards.I do that to some extent but feel like I am missing the basics.
anonymous
  • anonymous
i like to understand all that i can. at least one of the 'lessons' for this pset is to show how different data types can affect execution and how pre-processing data can affect execution. Itertools.combinations and permutations were not available when this course was taught - but everyone taking the course could have easily searched the internet or the library for algorithms. Never hurts to try it yourself and learn something doing it.
anonymous
  • anonymous
Maitre_kaio, I have a similar piece to yours but why do you need .join?I am using itertools.combination on a the list,current_hand, is your 'word' a string?Seems the results from each result of itertools will be a string which can be appended to the list,letter_combinations.OK,tell me what I am doing and thinking incorrectly. http://codepad.org/IpGN88Sr
anonymous
  • anonymous
@gambit did you read the documentation for itertools.combination?

Looking for something else?

Not the answer you are looking for? Search for more explanations.