diff --git a/d2/d5a/subset__sum_8cpp.html b/d0/dfe/backtracking_2subset__sum_8cpp.html similarity index 91% rename from d2/d5a/subset__sum_8cpp.html rename to d0/dfe/backtracking_2subset__sum_8cpp.html index 5eeb4d8b4..f68c0e85e 100644 --- a/d2/d5a/subset__sum_8cpp.html +++ b/d0/dfe/backtracking_2subset__sum_8cpp.html @@ -71,7 +71,7 @@ $(function() {
@@ -112,7 +112,7 @@ $(document).ready(function(){initNavTree('d2/d5a/subset__sum_8cpp.html','../../'
Include dependency graph for subset_sum.cpp:
-
+
@@ -127,13 +127,13 @@ Namespaces
- + - + - +

Functions

uint64_t backtracking::subset_sum::number_of_subsets (int32_t sum, const std::vector< int32_t > &in_arr)
uint64_t backtracking::subset_sum::number_of_subsets (int32_t sum, const std::vector< int32_t > &in_arr)
 The main function implements count of subsets.
 
static void test ()
static void test ()
 Test implementations.
 
int main ()
int main ()
 Main function.
 
@@ -160,14 +160,14 @@ Functions

Main function.

Returns
0 on exit
103 {
-
104 test(); // run self-test implementations
+
104 test(); // run self-test implementations
105 return 0;
106}
-
static void test()
Test implementations.
Definition: subset_sum.cpp:57
+
static void test()
Test implementations.
Definition: subset_sum.cpp:57
Here is the call graph for this function:
-
+
@@ -230,7 +230,7 @@ Here is the call graph for this function:
Here is the call graph for this function:
-
+
@@ -308,7 +308,7 @@ Here is the call graph for this function:
Here is the call graph for this function:
-
+
@@ -319,7 +319,7 @@ Here is the call graph for this function:
diff --git a/d0/dfe/backtracking_2subset__sum_8cpp.js b/d0/dfe/backtracking_2subset__sum_8cpp.js new file mode 100644 index 000000000..4a8fc4db5 --- /dev/null +++ b/d0/dfe/backtracking_2subset__sum_8cpp.js @@ -0,0 +1,6 @@ +var backtracking_2subset__sum_8cpp = +[ + [ "main", "d0/dfe/backtracking_2subset__sum_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "number_of_subsets", "d0/dfe/backtracking_2subset__sum_8cpp.html#a7cb50d36a59427a33f64a266dac83d99", null ], + [ "test", "d0/dfe/backtracking_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.map b/d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.map similarity index 100% rename from d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.map rename to d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.map diff --git a/d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.md5 b/d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.md5 similarity index 100% rename from d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.md5 rename to d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.md5 diff --git a/d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.svg b/d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.svg similarity index 100% rename from d2/d5a/subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.svg rename to d0/dfe/backtracking_2subset__sum_8cpp_a7cb50d36a59427a33f64a266dac83d99_cgraph.svg diff --git a/d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map similarity index 100% rename from d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map rename to d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map diff --git a/d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 similarity index 100% rename from d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 rename to d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 diff --git a/d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg similarity index 100% rename from d2/d5a/subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg rename to d0/dfe/backtracking_2subset__sum_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg diff --git a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map similarity index 62% rename from d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map rename to d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 055425968..7fe2735b8 100644 --- a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -1,5 +1,5 @@ - + diff --git a/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..2dce4b23f --- /dev/null +++ b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +3e90c87f106ae27e44d4362a9886707c \ No newline at end of file diff --git a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg similarity index 92% rename from d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg rename to d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index 36e3c7f7c..028d63c63 100644 --- a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d0/dfe/backtracking_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -20,7 +20,7 @@ Node2 - + test diff --git a/d2/d5a/subset__sum_8cpp.js b/d2/d5a/subset__sum_8cpp.js deleted file mode 100644 index 910f4f071..000000000 --- a/d2/d5a/subset__sum_8cpp.js +++ /dev/null @@ -1,6 +0,0 @@ -var subset__sum_8cpp = -[ - [ "main", "d2/d5a/subset__sum_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], - [ "number_of_subsets", "d2/d5a/subset__sum_8cpp.html#a7cb50d36a59427a33f64a266dac83d99", null ], - [ "test", "d2/d5a/subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] -]; \ No newline at end of file diff --git a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 deleted file mode 100644 index 8cc9a29b3..000000000 --- a/d2/d5a/subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ /dev/null @@ -1 +0,0 @@ -09ea0bfb6cfef47253584b2b3026c806 \ No newline at end of file diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp.html b/d6/d80/dynamic__programming_2subset__sum_8cpp.html new file mode 100644 index 000000000..6ffa96778 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp.html @@ -0,0 +1,375 @@ + + + + + + + +Algorithms_in_C++: dynamic_programming/subset_sum.cpp File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+ +
subset_sum.cpp File Reference
+
+
+ +

Implements [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells whether a subset with target sum exists or not. +More...

+
#include <cassert>
+#include <iostream>
+#include <vector>
+#include <unordered_map>
+
+Include dependency graph for subset_sum.cpp:
+
+
+
+
+
+ + + + + + + +

+Namespaces

namespace  dynamic_programming
 Dynamic Programming algorithms.
 
namespace  subset_sum
 Functions for [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm.
 
+ + + + + + + + + + + +

+Functions

bool dynamic_programming::subset_sum::subset_sum_recursion (const std::vector< int > &arr, int targetSum, std::vector< std::unordered_map< int, bool > > *dp, int index=0)
 
bool dynamic_programming::subset_sum::subset_sum_problem (const std::vector< int > &arr, const int targetSum)
 
static void test ()
 Test Function.
 
int main ()
 Main function.
 
+

Detailed Description

+

Implements [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells whether a subset with target sum exists or not.

+

In this problem, we use dynamic programming to find if we can pull out a subset from an array whose sum is equal to a given target sum. The overall time complexity of the problem is O(n * targetSum) where n is the size of the array. For example, array = [1, -10, 2, 31, -6], targetSum = -14. Output: true => We can pick subset [-10, 2, -6] with sum as (-10) + 2 + (-6) = -14.

Author
KillerAV
+

Function Documentation

+ +

◆ main()

+ +
+
+ + + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+
122 {
+
123 test(); // execute the test
+
124 return 0;
+
125}
+
static void test()
Test implementations.
Definition: subset_sum.cpp:57
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ subset_sum_problem()

+ +
+
+ + + + + + + + + + + + + + + + + + +
bool dynamic_programming::subset_sum::subset_sum_problem (const std::vector< int > & arr,
const int targetSum 
)
+
+

Function implementing subset sum algorithm using top-down approach

Parameters
+ + + +
arrinput array
targetSumthe target sum of the subset
+
+
+
Returns
true/false based on if the target sum subset exists or not.
+
72 {
+
73 size_t n = arr.size();
+ +
75 return subset_sum_recursion(arr, targetSum, &dp);
+
76}
+
bool subset_sum_recursion(const std::vector< int > &arr, int targetSum, std::vector< std::unordered_map< int, bool > > *dp, int index=0)
Definition: subset_sum.cpp:43
+
for std::vector
Definition: partition_problem.cpp:39
+
T size(T... args)
+ +
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ subset_sum_recursion()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool dynamic_programming::subset_sum::subset_sum_recursion (const std::vector< int > & arr,
int targetSum,
std::vector< std::unordered_map< int, bool > > * dp,
int index = 0 
)
+
+

Recursive function using dynamic programming to find if the required sum subset exists or not.

Parameters
+ + + + +
arrinput array
targetSumthe target sum of the subset
dpthe map storing the results
+
+
+
Returns
true/false based on if the target sum subset exists or not.
+
47 {
+
48
+
49 if(targetSum == 0) { // Found a valid subset with required sum.
+
50 return true;
+
51 }
+
52 if(index == arr.size()) { // End of array
+
53 return false;
+
54 }
+
55
+
56 if ((*dp)[index].count(targetSum)) { // Answer already present in map
+
57 return (*dp)[index][targetSum];
+
58 }
+
59
+
60 bool ans = subset_sum_recursion(arr, targetSum - arr[index], dp, index + 1)
+
61 || subset_sum_recursion(arr, targetSum, dp, index + 1);
+
62 (*dp)[index][targetSum] = ans; // Save ans in dp map.
+
63 return ans;
+
64}
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + +
static void test ()
+
+static
+
+ +

Test Function.

+
Returns
void
+
84 {
+
85 // custom input vector
+
86 std::vector<std::vector<int>> custom_input_arr(3);
+
87 custom_input_arr[0] = std::vector<int> {1, -10, 2, 31, -6};
+
88 custom_input_arr[1] = std::vector<int> {2, 3, 4};
+
89 custom_input_arr[2] = std::vector<int> {0, 1, 0, 1, 0};
+
90
+
91 std::vector<int> custom_input_target_sum(3);
+
92 custom_input_target_sum[0] = -14;
+
93 custom_input_target_sum[1] = 10;
+
94 custom_input_target_sum[2] = 2;
+
95
+
96 // calculated output vector by pal_part Function
+
97 std::vector<int> calculated_output(3);
+
98
+
99 for (int i = 0; i < 3; i++) {
+
100 calculated_output[i] =
+ +
102 custom_input_arr[i], custom_input_target_sum[i]);
+
103 }
+
104
+
105 // expected output vector
+
106 std::vector<bool> expected_output{true, false, true};
+
107
+
108 // Testing implementation via assert function
+
109 // It will throw error if any of the expected test fails
+
110 // Else it will give nothing
+
111 for (int i = 0; i < 3; i++) {
+
112 assert(expected_output[i] == calculated_output[i]);
+
113 }
+
114
+
115 std::cout << "All tests passed successfully!\n";
+
116}
+ +
bool subset_sum_problem(const std::vector< int > &arr, const int targetSum)
Definition: subset_sum.cpp:72
+
+
+
+
+
+ + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp.js b/d6/d80/dynamic__programming_2subset__sum_8cpp.js new file mode 100644 index 000000000..d913d7a7e --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp.js @@ -0,0 +1,7 @@ +var dynamic__programming_2subset__sum_8cpp = +[ + [ "main", "d6/d80/dynamic__programming_2subset__sum_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "subset_sum_problem", "d6/d80/dynamic__programming_2subset__sum_8cpp.html#ac94e6c0dee11278ac0a5491f1b9a4a50", null ], + [ "subset_sum_recursion", "d6/d80/dynamic__programming_2subset__sum_8cpp.html#a280fcfb2f6fe49a31c4da572e7032607", null ], + [ "test", "d6/d80/dynamic__programming_2subset__sum_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.map b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.map new file mode 100644 index 000000000..3e3f35102 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.map @@ -0,0 +1,4 @@ + + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.md5 b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.md5 new file mode 100644 index 000000000..ab3ed199d --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.md5 @@ -0,0 +1 @@ +b311e56f60a32b303af023d072eda551 \ No newline at end of file diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.svg b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.svg new file mode 100644 index 000000000..a96a1fb00 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_a280fcfb2f6fe49a31c4da572e7032607_cgraph.svg @@ -0,0 +1,44 @@ + + + + + + +dynamic_programming::subset_sum::subset_sum_recursion + + +Node1 + + +dynamic_programming +::subset_sum::subset +_sum_recursion + + + + + +Node1->Node1 + + + + + +Node2 + + +std::vector::size + + + + + +Node1->Node2 + + + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.map b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.map new file mode 100644 index 000000000..6d7ae6b7d --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.md5 b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.md5 new file mode 100644 index 000000000..31e352fbb --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.md5 @@ -0,0 +1 @@ +f1d51951fb66ba043abd6338e915f4d2 \ No newline at end of file diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.svg b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.svg new file mode 100644 index 000000000..52a9d1b39 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ac94e6c0dee11278ac0a5491f1b9a4a50_cgraph.svg @@ -0,0 +1,73 @@ + + + + + + +dynamic_programming::subset_sum::subset_sum_problem + + +Node1 + + +dynamic_programming +::subset_sum::subset +_sum_problem + + + + + +Node1->Node1 + + + + + +Node2 + + +std::vector::size + + + + + +Node1->Node2 + + + + + +Node3 + + +dynamic_programming +::subset_sum::subset +_sum_recursion + + + + + +Node1->Node3 + + + + + +Node3->Node2 + + + + + +Node3->Node3 + + + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..7fe2735b8 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..2dce4b23f --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +3e90c87f106ae27e44d4362a9886707c \ No newline at end of file diff --git a/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..028d63c63 --- /dev/null +++ b/d6/d80/dynamic__programming_2subset__sum_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,51 @@ + + + + + + +main + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + +Node3 + + +std::endl + + + + + +Node2->Node3 + + + + + diff --git a/db/da8/subset__sum_8cpp__incl.map b/db/d83/backtracking_2subset__sum_8cpp__incl.map similarity index 100% rename from db/da8/subset__sum_8cpp__incl.map rename to db/d83/backtracking_2subset__sum_8cpp__incl.map diff --git a/db/da8/subset__sum_8cpp__incl.md5 b/db/d83/backtracking_2subset__sum_8cpp__incl.md5 similarity index 100% rename from db/da8/subset__sum_8cpp__incl.md5 rename to db/d83/backtracking_2subset__sum_8cpp__incl.md5 diff --git a/db/da8/subset__sum_8cpp__incl.svg b/db/d83/backtracking_2subset__sum_8cpp__incl.svg similarity index 100% rename from db/da8/subset__sum_8cpp__incl.svg rename to db/d83/backtracking_2subset__sum_8cpp__incl.svg diff --git a/dc/d3a/namespacesubset__sum.html b/dc/d3a/namespacesubset__sum.html new file mode 100644 index 000000000..7f3e41bff --- /dev/null +++ b/dc/d3a/namespacesubset__sum.html @@ -0,0 +1,118 @@ + + + + + + + +Algorithms_in_C++: subset_sum Namespace Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ 1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
subset_sum Namespace Reference
+
+
+ +

Functions for [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm. +More...

+

Detailed Description

+

Functions for [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm.

+
+
+ + + + diff --git a/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.map b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.map new file mode 100644 index 000000000..3a1dcc269 --- /dev/null +++ b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.md5 b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.md5 new file mode 100644 index 000000000..2190b31c0 --- /dev/null +++ b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.md5 @@ -0,0 +1 @@ +0c4466196bb7c3fcb7f6264156e4e73c \ No newline at end of file diff --git a/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.svg b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.svg new file mode 100644 index 000000000..873028b14 --- /dev/null +++ b/dc/d53/dynamic__programming_2subset__sum_8cpp__incl.svg @@ -0,0 +1,82 @@ + + + + + + +dynamic_programming/subset_sum.cpp + + +Node1 + + +dynamic_programming +/subset_sum.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + +Node3 + + +iostream + + + + + +Node1->Node3 + + + + + +Node4 + + +vector + + + + + +Node1->Node4 + + + + + +Node5 + + +unordered_map + + + + + +Node1->Node5 + + + + + diff --git a/dd/d24/namespacedynamic__programming.html b/dd/d24/namespacedynamic__programming.html index 6802261f0..29efb835b 100644 --- a/dd/d24/namespacedynamic__programming.html +++ b/dd/d24/namespacedynamic__programming.html @@ -115,6 +115,7 @@ Functions

Detailed Description

Dynamic Programming algorithms.

Dynamic programming algorithms.

+

for unordered map

for std::vector

Dynamic Programming algorithm.

Dynamic Programming Algorithms.

@@ -124,6 +125,8 @@ Functions

for assert for std::max for IO operations

Dynamic Programming algorithms

for assert for IO operations

+

Dynamic Programming algorithms

+

for std::assert for IO operations for std::vector

Dynamic Programming algorithms

Function Documentation

diff --git a/dir_8a20dd5bfd5341a725342bf72b6b686f.html b/dir_8a20dd5bfd5341a725342bf72b6b686f.html index 842df9391..a1cf1aad8 100644 --- a/dir_8a20dd5bfd5341a725342bf72b6b686f.html +++ b/dir_8a20dd5bfd5341a725342bf72b6b686f.html @@ -136,6 +136,9 @@ Files file  shortest_common_supersequence.cpp  SCS is a string Z which is the shortest supersequence of strings X and Y (may not be continuous in Z, but order is maintained).
  +file  subset_sum.cpp + Implements [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells whether a subset with target sum exists or not.
+  file  word_break.cpp  Word Break Problem
  diff --git a/dir_8a20dd5bfd5341a725342bf72b6b686f.js b/dir_8a20dd5bfd5341a725342bf72b6b686f.js index d23b517f5..f89660c9c 100644 --- a/dir_8a20dd5bfd5341a725342bf72b6b686f.js +++ b/dir_8a20dd5bfd5341a725342bf72b6b686f.js @@ -11,5 +11,6 @@ var dir_8a20dd5bfd5341a725342bf72b6b686f = [ "minimum_edit_distance.cpp", "da/d52/minimum__edit__distance_8cpp.html", "da/d52/minimum__edit__distance_8cpp" ], [ "palindrome_partitioning.cpp", "d5/d90/palindrome__partitioning_8cpp.html", "d5/d90/palindrome__partitioning_8cpp" ], [ "shortest_common_supersequence.cpp", "d7/d65/shortest__common__supersequence_8cpp.html", "d7/d65/shortest__common__supersequence_8cpp" ], + [ "subset_sum.cpp", "d6/d80/dynamic__programming_2subset__sum_8cpp.html", "d6/d80/dynamic__programming_2subset__sum_8cpp" ], [ "word_break.cpp", "d3/d84/word__break_8cpp.html", "d3/d84/word__break_8cpp" ] ]; \ No newline at end of file diff --git a/dir_c11585dfcef32a26e29098facab6c144.html b/dir_c11585dfcef32a26e29098facab6c144.html index b85a1c6d2..2447af1c4 100644 --- a/dir_c11585dfcef32a26e29098facab6c144.html +++ b/dir_c11585dfcef32a26e29098facab6c144.html @@ -128,8 +128,8 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm file  subarray_sum.cpp  Subset-sum (only continuous subsets) problem
  -file  subset_sum.cpp - Implementation of the Subset Sum problem.
+file  subset_sum.cpp + Implementation of the Subset Sum problem.
  file  sudoku_solver.cpp  Sudoku Solver algorithm.
diff --git a/dir_c11585dfcef32a26e29098facab6c144.js b/dir_c11585dfcef32a26e29098facab6c144.js index 957391f86..78d0c4931 100644 --- a/dir_c11585dfcef32a26e29098facab6c144.js +++ b/dir_c11585dfcef32a26e29098facab6c144.js @@ -8,7 +8,7 @@ var dir_c11585dfcef32a26e29098facab6c144 = [ "nqueen_print_all_solutions.cpp", "d7/d24/nqueen__print__all__solutions_8cpp.html", "d7/d24/nqueen__print__all__solutions_8cpp" ], [ "rat_maze.cpp", "dc/d5a/rat__maze_8cpp.html", "dc/d5a/rat__maze_8cpp" ], [ "subarray_sum.cpp", "df/d94/subarray__sum_8cpp.html", "df/d94/subarray__sum_8cpp" ], - [ "subset_sum.cpp", "d2/d5a/subset__sum_8cpp.html", "d2/d5a/subset__sum_8cpp" ], + [ "subset_sum.cpp", "d0/dfe/backtracking_2subset__sum_8cpp.html", "d0/dfe/backtracking_2subset__sum_8cpp" ], [ "sudoku_solver.cpp", "d3/d05/sudoku__solver_8cpp.html", "d3/d05/sudoku__solver_8cpp" ], [ "wildcard_matching.cpp", "dc/d14/wildcard__matching_8cpp.html", "dc/d14/wildcard__matching_8cpp" ] ]; \ No newline at end of file diff --git a/files.html b/files.html index 526cea670..529e5d33c 100644 --- a/files.html +++ b/files.html @@ -112,7 +112,7 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });  rat_maze.cppImplements Rat in a Maze algorithm  subarray_sum.cppSubset-sum (only continuous subsets) problem - subset_sum.cppImplementation of the Subset Sum problem + subset_sum.cppImplementation of the Subset Sum problem  sudoku_solver.cppSudoku Solver algorithm  wildcard_matching.cppImplementation of the Wildcard Matching problem   bit_manipulation @@ -175,7 +175,8 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm  minimum_edit_distance.cppImplementation of Minimum Edit Distance using Dynamic Programing  palindrome_partitioning.cppImplements Palindrome Partitioning algorithm, giving you the minimum number of partitions you need to make  shortest_common_supersequence.cppSCS is a string Z which is the shortest supersequence of strings X and Y (may not be continuous in Z, but order is maintained) - word_break.cppWord Break Problem + subset_sum.cppImplements [Sub-set sum problem] (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells whether a subset with target sum exists or not + word_break.cppWord Break Problem   geometry  graham_scan_functions.hpp  jarvis_algorithm.cppImplementation of Jarvis’s algorithm diff --git a/globals_func_m.html b/globals_func_m.html index f043ce718..94fc1d483 100644 --- a/globals_func_m.html +++ b/globals_func_m.html @@ -100,7 +100,7 @@ $(document).ready(function(){initNavTree('globals_func_m.html',''); initResizabl  

- m -