knapsack_dynamic: Knapsack Dynamic Programming Implementation

Description Usage Arguments Value

View source: R/knapsack_dynamic.R

Description

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.

Usage

1

Arguments

x

Data frame with two numeric columns: weights and values

W

Total weight of the knapsack

Value

List with numbers of items that can be put into knapsack and maximum obtained value


faridmusayev/R_lab06 documentation built on Dec. 20, 2021, 7:44 a.m.