Skip to content

Commit ba74e24

Browse files
committed
clang-format and clang-tidy fixes for 825bcd5
1 parent 825bcd5 commit ba74e24

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

dynamic_programming/0_1_knapsack.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ namespace dynamic_programming {
3939
namespace knapsack {
4040
/**
4141
* @brief Picking up all those items whose combined weight is below
42-
* the given capacity and calculating the value of those picked items. Trying all
43-
* possible combinations will yield the maximum knapsack value.
42+
* the given capacity and calculating the value of those picked items. Trying
43+
* all possible combinations will yield the maximum knapsack value.
4444
* @tparam n size of the weight and value array
4545
* @param capacity capacity of the carrying bag
4646
* @param weight array representing the weight of items
@@ -62,9 +62,9 @@ int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
6262
// will be zero
6363
maxValue[i][j] = 0;
6464
} else if (weight[i - 1] <= j) {
65-
// if the ith item's weight(in the actual array it will be at i-1)
66-
// is less than or equal to the allowed weight i.e. j then we
67-
// can pick that item for our knapsack. maxValue will be the
65+
// if the ith item's weight(in the actual array it will be at
66+
// i-1) is less than or equal to the allowed weight i.e. j then
67+
// we can pick that item for our knapsack. maxValue will be the
6868
// obtained either by picking the current item or by not picking
6969
// current item
7070

@@ -76,8 +76,9 @@ int maxKnapsackValue(const int capacity, const std::array<int, n> &weight,
7676

7777
maxValue[i][j] = std::max(profit1, profit2);
7878
} else {
79-
// as the weight of the current item is greater than the allowed weight, so
80-
// maxProfit will be profit obtained by excluding the current item.
79+
// as the weight of the current item is greater than the allowed
80+
// weight, so maxProfit will be profit obtained by excluding the
81+
// current item.
8182
maxValue[i][j] = maxValue[i - 1][j];
8283
}
8384
}

0 commit comments

Comments
 (0)