Ask
your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW)
6 Online
I have been stuck on problem set 6, problem #4, about the even faster computer player, how do I write code to create each subset S of the letters of HAND, e.g. if the letters are [a, b, c, d], there are 11 combinations like ab, ac, ad, bc, bd, cd, abc, abd, acd, bcd, abcd? How do I iterate to create these subsets?
Still Need Help?
Join the QuestionCove community and study together with friends!
4 letters make 16 combinations(2 to the 4th power), 1 of them empty. Iterate from 0000 to 1111 in binary numbers on this 4 letters case, each digital shows whether the corresponding letter is in the combination. i.e: .word = ‘a’ * 1 + 'b' * 0 + 'c' * 1 + 'd' * 1 word = 'acd' But I think recursive way might be better. subsets of (a, b, c, d) consist of subsets of (a, b, c) and all their combinations with (d,).
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!
Join our real-time social learning platform and learn together with your friends!
Latest Questions
playtsec:
how do I sleep without getting a sore throat? I always wake up with a sore throat but it goes away later in the day.
75:
how do you react when you deal with someone who plays the victim in every single situation, and do you find this behavior childish or annoying.
JohnnyLFowler0812:
Do you guys ever think that the homeless are going to be healthy and freed from h
JohnnyLFowler0812:
Do you guys ever think that Hikaru Nikanura will ever be take Magnus Calrsen's 1st place title in the wolrdin the United States amd Norway? Right now Hikaru
DoltonCarlee:
what are y'all's options on S A T essays because honestly their not that bad
thereneelg:
Can someone give me a summary of article 231, The war guilt clause?? I need to explain what it is, but I can't find any shortened version of what it is and
luisaam2:
What should you do when the person you want to talk to the most is the one making
1 hour ago
8 Replies
2 Medals
1 hour ago
2 Replies
0 Medals
54 minutes ago
6 Replies
1 Medal
3 hours ago
2 Replies
0 Medals
3 hours ago
7 Replies
2 Medals
3 days ago
7 Replies
1 Medal
2 days ago
16 Replies
1 Medal