Repository: TheAlgorithms/C-Plus-Plus
File: dynamic_programming/Unbounded_0_1_Knapsack.cpp (C++)

Code before:
 * The Unbounded 0/1 Knapsack problem allows taking unlimited quantities of each item. 
 * The goal is to maximize the total value without exceeding the given knapsack capacity. 
 * Unlike the 0/1 knapsack, where each item can be taken only once, in this variation, 
 * any item can be picked any number of times as long as the total weight stays within 
 * the knapsack's capacity.
 * 
 * Given a set of N items, each with a weight and a value, represented by the arrays 
 * `wt` and `val` respectively, and a knapsack with a weight limit W, the task is to 
 * fill the knapsack to maximize the total value.
 *
 * @note weight and value of items is greater than zero.
 *
 * ### Algorithm
 * The approach uses dynamic programming to build a solution iteratively. 
 * A 2D array is used for memoization to store intermediate results, allowing 
 * the function to avoid redundant calculations.
 * 
 * @author [Sanskruti Yeole](https://github.com/yeolesanskruti)
 * @see dynamic_programming/0_1_knapsack.cpp
 */

#include <iostream>  ///< Standard input-output stream
#include <vector>   ///< Standard library for using dynamic arrays (vectors)
#include <cassert>  ///< For using assert function to validate test cases
#include <cstdint>  ///< For fixed-width integer types like std::uint16_t

/**
 * @namespace dynamic_programming
 * @brief Namespace for dynamic programming algorithms
 */
namespace dynamic_programming {

/**
 * @namespace Knapsack
 * @brief Implementation of unbounded 0-1 knapsack problem
 */
namespace unbounded_knapsack {

/**
 * @brief Recursive function to calculate the maximum value obtainable using 
 *        an unbounded knapsack approach.
 *
 * @param i Current index in the value and weight vectors.
 * @param W Remaining capacity of the knapsack.
 * @param val Vector of values corresponding to the items.
 * @param wt Vector of weights corresponding to the items.
 * @param dp 2D vector for memoization to avoid redundant calculations.
 * @return The maximum value that can be obtained for the given index and capacity.
 */
int KnapSackFilling(std::uint16_t i, std::uint16_t W, 
                    const std::vector<std::uint16_t>& val, 

Review comment (suggestion):
```suggestion
#include <iostream>  // Standard input-output stream
#include <vector>   // Standard library for using dynamic arrays (vectors)
#include <cassert>  // For using assert function to validate test cases
#include <cstdint>  // For fixed-width integer types like std::uint16_t

```


Code after:
 * The Unbounded 0/1 Knapsack problem allows taking unlimited quantities of each item. 
 * The goal is to maximize the total value without exceeding the given knapsack capacity. 
 * Unlike the 0/1 knapsack, where each item can be taken only once, in this variation, 
 * any item can be picked any number of times as long as the total weight stays within 
 * the knapsack's capacity.
 * 
 * Given a set of N items, each with a weight and a value, represented by the arrays 
 * `wt` and `val` respectively, and a knapsack with a weight limit W, the task is to 
 * fill the knapsack to maximize the total value.
 *
 * @note weight and value of items is greater than zero 
 *
 * ### Algorithm
 * The approach uses dynamic programming to build a solution iteratively. 
 * A 2D array is used for memoization to store intermediate results, allowing 
 * the function to avoid redundant calculations.
 * 
 * @author [Sanskruti Yeole](https://github.com/yeolesanskruti)
 * @see dynamic_programming/0_1_knapsack.cpp
 */

#include <iostream>  // Standard input-output stream
#include <vector>   // Standard library for using dynamic arrays (vectors)
#include <cassert>  // For using assert function to validate test cases
#include <cstdint>  // For fixed-width integer types like std::uint16_t

/**
 * @namespace dynamic_programming
 * @brief Namespace for dynamic programming algorithms
 */
namespace dynamic_programming {

/**
 * @namespace Knapsack
 * @brief Implementation of unbounded 0-1 knapsack problem
 */
namespace unbounded_knapsack {

/**
 * @brief Recursive function to calculate the maximum value obtainable using 
 *        an unbounded knapsack approach.
 *
 * @param i Current index in the value and weight vectors.
 * @param W Remaining capacity of the knapsack.
 * @param val Vector of values corresponding to the items.
 * @note "val" data type can be changed according to the size of the input.
 * @param wt Vector of weights corresponding to the items.
 * @note "wt" data type can be changed according to the size of the input.
 * @param dp 2D vector for memoization to avoid redundant calculations.
 * @return The maximum value that can be obtained for the given index and capacity.
 */