DEV Community

Discussion on: Knapsack problem algorithms for my real-life carry-on knapsack

Collapse
 
falansari profile image
Ash

Yep, this. I was going to comment about items that change in importance based on destination. For example, her gloves are not showing up in the results set, however they're mandatory if she's going to a very cold country! Her sunglasses on the other hand are always present, yet they're not that necessary if she's going to the UK ;) your approach fixes these issues of "must have items for this trip"

Collapse
 
victoria profile image
Victoria Drake

In short, yes. To carry the analogy through I left all the items in, but as a practical exercise, removing the mandatory ones from the calculation makes more sense. :)