knapsack problem (classic)
问题 So I have to solve the knapsack problem for class. So far, I've come up with the following. My comparators are functions that determine which of two subjects will be the better option (by looking at the corresponding (value,work) tuples). I decided to iterate over the possible subjects with work less than maxWork, and in order to find which subject is the best option at any given turn, I compared my most recent subject to all the other subjects that we have not used yet. def greedyAdvisor