Description Usage Arguments Value
View source: R/knapsack_dynamic.R
This is a dynamic programming (DP) approach to solving knapsack problem. Here a tabulation method is used. DP approach results into better performance due to O(W*n) gain.
1 | knapsack_dynamic(x, W)
|
x |
Data frame with two numeric columns: weights and values |
W |
Total weight of the knapsack |
List with numbers of items that can be put into knapsack and maximum obtained value
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.