Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 20 Online
OpenStudy (anonymous):

I'm on problem set 6 working on pick_best_word_faster. What does it mean by "for each subset S of letters in hand"? Are we supposed to find all possible subsets? I'd like some example code, but I can't seem to find out how to search previous questions in OpenStudy

OpenStudy (anonymous):

because the dictionary keys are ordered (sorted) you only need to find all the (ordered/sorted) combinations - NOT permutations. if hand is 5 letters you need to find the combinations of 1, 2, 3, 4, and 5 letters if you search for combination algorithms/code there should be a lot of hits. a search for powerset should yield some results. we can show you our code right off the bat if you want and there are some fairly recent threads on this subject.

OpenStudy (anonymous):

Or you could use the standard "combinations" imported from itertools.

OpenStudy (anonymous):

:) i was saving that for later, in case six wanted to try to make one. maybe not exactly germaine to the pset, but it is a good exercise. I origianlly started out making one, found itertools and used it, then went back and made one anyway - to see if i could

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!