Function ADS::knapsack

Function Documentation

inline std::pair<long, std::vector<std::size_t>> ADS::knapsack(const std::vector<long> &p, const std::vector<long> &v, long C)

the best profit and a set of objects, by places, of the 0-1 knapsack

Pre:

|p| = |v|, p , v >= 0, C >= 0

Post:

the objects fit and give the profit