Spring 2011 Course - PS9, Problem 3 I'm having trouble figuring out how to generate all the possible combinations to test using brute force... does anyone have any hints?
you can go to python library and search for the function combination. Well, I dont remember exactly, but I know the library have a function like that, dont try to reinvent a new one.
Did the 2011 course have a lecture(s) that introduced the binary decision tree and/or the knapsack problem? This is a Knapsack problem. In one of the 2008 lectures a function that solved the knapsack problem was shown. That can be adapted to this pset problem - at least the way it works will be the same or similar for this pset problem.
bwCA, yes, we did cover knapsack and I'm pretty sure we provided the code for a brute force search of the solution space.
Thanks guys, I'll go look back in the lecture.
I just ended up using Guttag's genPset function from the lecture to help me out. I was already trying to make a similar function myself, but I kept running into problems.
Join our real-time social learning platform and learn together with your friends!