KnapsackUtils constructor

const KnapsackUtils(
  1. int weight,
  2. int value
)

Creates a knapsack item with the given weight (cost) and value (profit).

Implementation

const KnapsackUtils(int weight, int value) : _weight = weight, _value = value;