From 7cbe15159e6d9da3f2c1461623700f91c7722800 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 9 Aug 2021 13:06:35 +0000 Subject: [PATCH] Documentation for 20f74d413866f05beb2786994fcf8962361a6f0d --- ...__for__fast__multiplication_8cpp__incl.map | 7 + ...__for__fast__multiplication_8cpp__incl.md5 | 1 + ...__for__fast__multiplication_8cpp__incl.svg | 84 +++ d1/d9a/hopcroft__karp_8cpp.html | 12 +- d2/d26/count__inversions_8cpp.html | 2 +- d3/df9/recursive__bubble__sort_8cpp.html | 2 +- d4/d32/inorder__successor__of__bst_8cpp.html | 8 +- d4/d38/power__of__two_8cpp.html | 2 +- d4/d8d/jarvis__algorithm_8cpp.html | 2 +- d5/d33/gram__schmidt_8cpp.html | 2 +- d5/d45/sublist__search_8cpp.html | 4 +- d5/d88/md__d_i_r_e_c_t_o_r_y.html | 37 +- d5/ddb/bogo__sort_8cpp.html | 2 +- d6/d10/cut__rod_8cpp.html | 2 +- d7/d73/abbreviation_8cpp.html | 2 +- d8/d90/iterative__tree__traversals_8cpp.html | 6 +- ...connected__components__with__dsu_8cpp.html | 2 +- da/d52/minimum__edit__distance_8cpp.html | 2 +- ...rithm__for__fast__multiplication_8cpp.html | 425 ++++++++++++++ ...gorithm__for__fast__multiplication_8cpp.js | 7 + ...a890d2f26855ada3b9f1d43aec70a86_cgraph.map | 10 + ...a890d2f26855ada3b9f1d43aec70a86_cgraph.md5 | 1 + ...a890d2f26855ada3b9f1d43aec70a86_cgraph.svg | 149 +++++ ...d1dbae365c7746295d3322e6f7f80b6_cgraph.map | 8 + ...d1dbae365c7746295d3322e6f7f80b6_cgraph.md5 | 1 + ...d1dbae365c7746295d3322e6f7f80b6_cgraph.svg | 105 ++++ ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 4 + ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 1 + ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 37 ++ ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 5 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 1 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 52 ++ db/d16/0__1__knapsack_8cpp.html | 2 +- db/dca/kadane2_8cpp.html | 2 +- dd/d47/namespacemath.html | 2 +- dd/dba/namespacedivide__and__conquer.html | 114 ++++ de/d41/namespacekaratsuba__algorithm.html | 112 ++++ df/d66/vector__cross__product_8cpp.html | 2 +- ...0002_000015.html => dir_000002_000016.html | 0 dir_4d6e05837bf820fb089a8a8cdf2f42b7_dep.map | 2 +- dir_4d6e05837bf820fb089a8a8cdf2f42b7_dep.md5 | 2 +- dir_4d6e05837bf820fb089a8a8cdf2f42b7_dep.svg | 2 +- dir_93bc990c5cceb745f78af6949e9ef947.html | 114 ++++ dir_93bc990c5cceb745f78af6949e9ef947.js | 4 + files.html | 378 ++++++------ files_dup.js | 1 + globals_func_i.html | 6 +- globals_func_m.html | 1 + globals_func_t.html | 1 + globals_i.html | 8 +- globals_m.html | 1 + globals_t.html | 1 + index.html | 8 +- namespacemembers.html | 12 +- namespacemembers_func.html | 12 +- namespaces.html | 294 +++++----- namespaces_dup.js | 2 + navtreedata.js | 57 +- navtreeindex0.js | 496 ++++++++-------- navtreeindex1.js | 500 ++++++++-------- navtreeindex10.js | 158 ++--- navtreeindex11.js | 238 ++++---- navtreeindex12.js | 192 +++--- navtreeindex13.js | 109 ++-- navtreeindex2.js | 204 +++---- navtreeindex3.js | 292 ++++----- navtreeindex4.js | 292 ++++----- navtreeindex5.js | 210 +++---- navtreeindex6.js | 284 ++++----- navtreeindex7.js | 312 +++++----- navtreeindex8.js | 230 ++++---- navtreeindex9.js | 234 ++++---- search/all_10.js | 154 ++--- search/all_11.js | 266 ++++----- search/all_12.js | 52 +- search/all_13.js | 256 ++++---- search/all_14.js | 552 +++++++++--------- search/all_15.js | 286 ++++----- search/all_16.js | 148 ++--- search/all_17.js | 108 ++-- search/all_18.js | 184 +++--- search/all_19.js | 12 +- search/all_1a.js | 8 +- search/all_1b.js | 6 +- search/all_1c.js | 194 +++--- search/all_2.js | 175 +++--- search/all_3.js | 248 ++++---- search/all_4.js | 276 ++++----- search/all_5.js | 253 ++++---- search/all_6.js | 148 ++--- search/all_7.js | 274 ++++----- search/all_8.js | 214 +++---- search/all_9.js | 100 ++-- search/all_a.js | 443 +++++++------- search/all_b.js | 16 +- search/all_c.js | 38 +- search/all_d.js | 188 +++--- search/all_e.js | 298 +++++----- search/all_f.js | 180 +++--- search/classes_0.js | 54 +- search/classes_1.js | 128 ++-- search/classes_10.js | 10 +- search/classes_11.js | 82 +-- search/classes_12.js | 100 ++-- search/classes_13.js | 54 +- search/classes_14.js | 72 +-- search/classes_15.js | 48 +- search/classes_16.js | 62 +- search/classes_17.js | 4 +- search/classes_18.js | 2 +- search/classes_2.js | 74 +-- search/classes_3.js | 32 +- search/classes_4.js | 36 +- search/classes_5.js | 34 +- search/classes_6.js | 12 +- search/classes_7.js | 18 +- search/classes_8.js | 210 +++---- search/classes_9.js | 2 +- search/classes_a.js | 4 +- search/classes_b.js | 36 +- search/classes_c.js | 76 +-- search/classes_d.js | 42 +- search/classes_e.js | 24 +- search/classes_f.js | 38 +- search/defines_0.js | 4 +- search/defines_1.js | 4 +- search/defines_2.js | 4 +- search/defines_3.js | 4 +- search/defines_4.js | 2 +- search/defines_5.js | 4 +- search/defines_6.js | 4 +- search/defines_7.js | 4 +- search/files_0.js | 2 +- search/files_1.js | 10 +- search/files_10.js | 30 +- search/files_11.js | 16 +- search/files_12.js | 14 +- search/files_13.js | 44 +- search/files_14.js | 16 +- search/files_15.js | 4 +- search/files_16.js | 8 +- search/files_17.js | 8 +- search/files_18.js | 2 +- search/files_2.js | 32 +- search/files_3.js | 30 +- search/files_4.js | 20 +- search/files_5.js | 8 +- search/files_6.js | 24 +- search/files_7.js | 16 +- search/files_8.js | 20 +- search/files_9.js | 14 +- search/files_a.js | 6 +- search/files_b.js | 11 +- search/files_c.js | 32 +- search/files_d.js | 24 +- search/files_e.js | 20 +- search/files_f.js | 8 +- search/functions_0.js | 12 +- search/functions_1.js | 173 +++--- search/functions_10.js | 184 +++--- search/functions_11.js | 22 +- search/functions_12.js | 176 +++--- search/functions_13.js | 418 ++++++------- search/functions_14.js | 208 +++---- search/functions_15.js | 96 +-- search/functions_16.js | 46 +- search/functions_17.js | 152 ++--- search/functions_18.js | 6 +- search/functions_19.js | 2 +- search/functions_1a.js | 4 +- search/functions_1b.js | 194 +++--- search/functions_2.js | 132 ++--- search/functions_3.js | 180 +++--- search/functions_4.js | 204 +++---- search/functions_5.js | 120 ++-- search/functions_6.js | 226 +++---- search/functions_7.js | 182 +++--- search/functions_8.js | 48 +- search/functions_9.js | 230 ++++---- search/functions_a.js | 6 +- search/functions_b.js | 19 +- search/functions_c.js | 114 ++-- search/functions_d.js | 198 +++---- search/functions_e.js | 120 ++-- search/functions_f.js | 130 ++--- search/groups_0.js | 2 +- search/groups_1.js | 4 +- search/groups_2.js | 2 +- search/namespaces_0.js | 6 +- search/namespaces_1.js | 10 +- search/namespaces_10.js | 10 +- search/namespaces_11.js | 38 +- search/namespaces_12.js | 6 +- search/namespaces_13.js | 2 +- search/namespaces_14.js | 4 +- search/namespaces_15.js | 8 +- search/namespaces_16.js | 2 +- search/namespaces_2.js | 16 +- search/namespaces_3.js | 11 +- search/namespaces_4.js | 4 +- search/namespaces_5.js | 6 +- search/namespaces_6.js | 8 +- search/namespaces_7.js | 8 +- search/namespaces_8.js | 2 +- search/namespaces_9.js | 5 +- search/namespaces_a.js | 12 +- search/namespaces_b.js | 18 +- search/namespaces_c.js | 14 +- search/namespaces_d.js | 4 +- search/namespaces_e.js | 6 +- search/namespaces_f.js | 6 +- search/pages_0.js | 2 +- search/pages_1.js | 6 +- search/pages_2.js | 2 +- search/pages_3.js | 2 +- search/pages_4.js | 4 +- search/related_0.js | 10 +- search/typedefs_0.js | 2 +- search/typedefs_1.js | 2 +- search/typedefs_2.js | 2 +- search/typedefs_3.js | 4 +- search/typedefs_4.js | 2 +- search/variables_0.js | 4 +- search/variables_1.js | 12 +- search/variables_10.js | 10 +- search/variables_11.js | 22 +- search/variables_12.js | 20 +- search/variables_13.js | 2 +- search/variables_14.js | 8 +- search/variables_15.js | 6 +- search/variables_16.js | 2 +- search/variables_17.js | 2 +- search/variables_2.js | 2 +- search/variables_3.js | 6 +- search/variables_4.js | 8 +- search/variables_5.js | 4 +- search/variables_6.js | 10 +- search/variables_7.js | 2 +- search/variables_8.js | 18 +- search/variables_9.js | 8 +- search/variables_a.js | 2 +- search/variables_b.js | 10 +- search/variables_c.js | 18 +- search/variables_d.js | 10 +- search/variables_e.js | 20 +- search/variables_f.js | 4 +- 246 files changed, 8997 insertions(+), 7723 deletions(-) create mode 100644 d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.map create mode 100644 d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.md5 create mode 100644 d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.svg create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.html create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp.js create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7a890d2f26855ada3b9f1d43aec70a86_cgraph.map create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7a890d2f26855ada3b9f1d43aec70a86_cgraph.md5 create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7a890d2f26855ada3b9f1d43aec70a86_cgraph.svg create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7d1dbae365c7746295d3322e6f7f80b6_cgraph.map create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7d1dbae365c7746295d3322e6f7f80b6_cgraph.md5 create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_a7d1dbae365c7746295d3322e6f7f80b6_cgraph.svg create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 create mode 100644 da/dd3/karatsuba__algorithm__for__fast__multiplication_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg create mode 100644 dd/dba/namespacedivide__and__conquer.html create mode 100644 de/d41/namespacekaratsuba__algorithm.html rename dir_000002_000015.html => dir_000002_000016.html (100%) create mode 100644 dir_93bc990c5cceb745f78af6949e9ef947.html create mode 100644 dir_93bc990c5cceb745f78af6949e9ef947.js diff --git a/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.map b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.map new file mode 100644 index 000000000..ce9396eb0 --- /dev/null +++ b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.map @@ -0,0 +1,7 @@ + diff --git a/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.md5 b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.md5 new file mode 100644 index 000000000..6152f7748 --- /dev/null +++ b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.md5 @@ -0,0 +1 @@ +07b418cea3de6228d912116269a882f0 \ No newline at end of file diff --git a/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.svg b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.svg new file mode 100644 index 000000000..75691028a --- /dev/null +++ b/d0/d2c/karatsuba__algorithm__for__fast__multiplication_8cpp__incl.svg @@ -0,0 +1,84 @@ + + + + + diff --git a/d1/d9a/hopcroft__karp_8cpp.html b/d1/d9a/hopcroft__karp_8cpp.html index fb0593371..54510a11f 100644 --- a/d1/d9a/hopcroft__karp_8cpp.html +++ b/d1/d9a/hopcroft__karp_8cpp.html @@ -138,22 +138,22 @@ Functions
Implementation of Hopcroft–Karp algorithm.
The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph and produces as output a maximum cardinality matching, it runs in O(E√V) time in worst case.
-A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts of the graph. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.
-Given a matching M, edges that are part of matching are called Matching edges and edges that are not part of M (or connect free nodes) are called Not-Matching edges.
-Given a bipartite graphs G = ( V = ( X , Y ) , E ) whose partition has the parts X and Y, with E denoting the edges of the graph, the goal is to find a matching with as many edges as possible. Equivalently, a matching that covers as many vertices as possible.
-Given a matching M, an augmenting path is an alternating path that starts from and ends on free vertices. All single edge paths that start and end with free vertices are augmenting paths.
-A matching M is not maximum if there exists an augmenting path. It is also true other way, i.e, a matching is maximum if no augmenting path exists.
-1) Initialize the Maximal Matching M as empty. 2) While there exists an Augmenting Path P Remove matching edges of P from M and add not-matching edges of P to M (This increases size of M by 1 as P starts and ends with a free vertex i.e. a node that is not part of matching.) 3) Return M.
diff --git a/d2/d26/count__inversions_8cpp.html b/d2/d26/count__inversions_8cpp.html index 2d31a3018..40208957e 100644 --- a/d2/d26/count__inversions_8cpp.html +++ b/d2/d26/count__inversions_8cpp.html @@ -152,7 +152,7 @@ Functionstwo elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j
Time Complexity --> O(n.log n)
Space Complexity --> O(n) ; additional array temp[1..n]
The working principle of the Bubble sort algorithm.
Bubble sort is a simple sorting algorithm used to rearrange a set of ascending or descending order elements. Bubble sort gets its name from the fact that data "bubbles" to the top of the dataset.
-What is Swap?
Swapping two numbers means that we interchange their values. Often, an additional variable is required for this operation. This is further illustrated in the following:
diff --git a/d4/d32/inorder__successor__of__bst_8cpp.html b/d4/d32/inorder__successor__of__bst_8cpp.html index 936913f35..5c630a667 100644 --- a/d4/d32/inorder__successor__of__bst_8cpp.html +++ b/d4/d32/inorder__successor__of__bst_8cpp.html @@ -164,21 +164,21 @@ FunctionsAn implementation for finding the Inorder successor of a binary search tree Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal.
-* In this case, the left-most deepest node in the right subtree will
come just after the given node as we go to left deep in inorder.
Implementation to check whether a number is a power of 2 or not.
This algorithm uses bit manipulation to check if a number is a power of 2 or not.
-Let the input number be n, then the bitwise and between n and n-1 will let us know whether the number is power of 2 or not
For Example, If N= 32 then N-1 is 31, if we perform bitwise and of these two numbers then the result will be zero, which indicates that it is the power of 2 If N=23 then N-1 is 22, if we perform bitwise and of these two numbers then the result will not be zero , which indicates that it is not the power of 2
Implementation of Jarvis’s algorithm.
Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it.
-The idea of Jarvis’s Algorithm is simple, we start from the leftmost point (or point with minimum x coordinate value) and we keep wrapping points in counterclockwise direction.
The idea is to use orientation() here. Next point is selected as the point that beats all other points at counterclockwise orientation, i.e., next point is q if for any other point r, we have “orientation(p, q, r) = counterclockwise”.
diff --git a/d5/d33/gram__schmidt_8cpp.html b/d5/d33/gram__schmidt_8cpp.html index bb3d6e860..e6b3367c4 100644 --- a/d5/d33/gram__schmidt_8cpp.html +++ b/d5/d33/gram__schmidt_8cpp.html @@ -140,7 +140,7 @@ FunctionsGram Schmidt Orthogonalisation Process
Takes the input of Linearly Independent Vectors, returns vectors orthogonal to each other.
-Take the first vector of given LI vectors as first vector of Orthogonal vectors. Take projection of second input vector on the first vector of Orthogonal vector and subtract it from the 2nd LI vector. Take projection of third vector on the second vector of Othogonal vectors and subtract it from the 3rd LI vector. Keep repeating the above process until all the vectors in the given input array are exhausted.
For Example: In R2, Input LI Vectors={(3,1),(2,2)} then Orthogonal Vectors= {(3, 1),(-0.4, 1.2)}
diff --git a/d5/d45/sublist__search_8cpp.html b/d5/d45/sublist__search_8cpp.html index 36b5c562f..f64e9beba 100644 --- a/d5/d45/sublist__search_8cpp.html +++ b/d5/d45/sublist__search_8cpp.html @@ -149,14 +149,14 @@ FunctionsImplementation of the Sublist Search Algorithm
-Implementation of Bogosort algorithm
In computer science, bogosort (also known as permutation sort, stupid sort, slowsort, shotgun sort, random sort, monkey sort, bobosort or shuffle sort) is a highly inefficient sorting algorithm based on the generate and test paradigm. Two versions of this algorithm exist: a deterministic version that enumerates all permutations until it hits a sorted one, and a randomized version that randomly permutes its input.Randomized version is implemented here.
-Shuffle the array untill array is sorted.
diff --git a/d6/d10/cut__rod_8cpp.html b/d6/d10/cut__rod_8cpp.html index 6d78b405a..19ba0d116 100644 --- a/d6/d10/cut__rod_8cpp.html +++ b/d6/d10/cut__rod_8cpp.html @@ -136,7 +136,7 @@ FunctionsImplementation of cutting a rod problem.
Given a rod of length n inches and an array of prices that contains prices of all pieces of size<=n. Determine the maximum profit obtainable by cutting up the rod and selling the pieces.
-The idea is to break the given rod into every smaller piece as possible and then check profit for each piece, by calculating maximum profit for smaller pieces we will build the solution for larger pieces in bottom-up manner.
a's lowercase letters.a.The idea is in the problem statement itself: iterate through characters of string a and b (for character indexes i and j respectively):
a[i] and b[j] are equal, then move to next positionIterative version of Preorder, Postorder, and preorder Traversal of the Tree
-Create a Stack that will store the Node of Tree. Push the root node into the stack. Save the root into the variabe named as current, and pop and elemnt from the stack. Store the data of current into the result array, and start traversing from it. Push both the child node of the current node into the stack, first right child then left child. Repeat the same set of steps untill the Stack becomes empty. And return the result array as the preorder traversal of a tree.
-Create a Stack that will store the Node of Tree. Push the root node into the stack. Save the root into the variabe named as current, and pop and elemnt from the stack. Store the data of current into the result array, and start traversing from it. Push both the child node of the current node into the stack, first left child then right child. Repeat the same set of steps untill the Stack becomes empty. Now reverse the result array and then return it to the calling function as a postorder traversal of a tree.
-Create a Stack that will store the Node of Tree. Push the root node into the stack. Save the root into the variabe named as current. Now iterate and take the current to the extreme left of the tree by traversing only to its left. Pop the elemnt from the stack and assign it to the current. Store the data of current into the result array. Repeat the same set of steps until the Stack becomes empty or the current becomes NULL. And return the result array as the inorder traversal of a tree.
The Disjoint union is the technique to find connected component in graph efficiently.
-In Graph, if you have to find out the number of connected components, there are 2 options
Implementation of Minimum Edit Distance using Dynamic Programing.
Given two strings str1 & str2 and we have to calculate the minimum number of operations (Insert, Remove, Replace) required to convert str1 to str2.
-We will solve this problem using Naive recursion. But as we are approaching with a DP solution. So, we will take a DP array to store the solution of all sub-problems so that we don't have to perform recursion again and again. Now to solve the problem, We can traverse all characters from either right side of the strings or left side. Suppose we will do it from the right side. So, there are two possibilities for every pair of characters being traversed.
|
+ Algorithms_in_C++
+ 1.0.0
+
+ Set of algorithms implemented in C++.
+ |
+
Implementation of the Karatsuba algorithm for fast multiplication +More...
+#include <cassert>#include <cstring>#include <iostream>#include <vector>+Namespaces | |
| divide_and_conquer | |
| for std::vector | |
| karatsuba_algorithm | |
| Functions for the Karatsuba algorithm for fast multiplication | |
+Functions | |
| std::string | divide_and_conquer::karatsuba_algorithm::addStrings (std::string first, std::string second) |
| Helper function for the main function, that implements Karatsuba's algorithm for fast multiplication. More... | |
| int64_t | divide_and_conquer::karatsuba_algorithm::karatsuba_algorithm (std::string str1, std::string str2) |
| The main function implements Karatsuba's algorithm for fast multiplication. More... | |
| static void | test () |
| Self-test implementations. More... | |
| int | main () |
| Main function. More... | |
Implementation of the Karatsuba algorithm for fast multiplication
+Given two strings in binary notation we want to multiply them and return the value Simple approach is to multiply bits one by one which will give the time complexity of around O(n^2). To make it more efficient we will be using Karatsuba' algorithm to find the product which will solve the problem O(nlogn) of time.
+| std::string divide_and_conquer::karatsuba_algorithm::addStrings | +( | +std::string | +first, | +
| + | + | std::string | +second | +
| + | ) | ++ |
Helper function for the main function, that implements Karatsuba's algorithm for fast multiplication.
+| first | the input string 1 |
| second | the input string 2 |
| int64_t divide_and_conquer::karatsuba_algorithm::karatsuba_algorithm | +( | +std::string | +str1, | +
| + | + | std::string | +str2 | +
| + | ) | ++ |
The main function implements Karatsuba's algorithm for fast multiplication.
+| str1 | the input string 1 |
| str2 | the input string 2 |
| int main | +( | +void | +) | ++ |
+
|
+ +static | +
Self-test implementations.
+Implementation of 0-1 Knapsack Problem
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which represents knapsack capacity, find out the maximum value subset of val[] such that sum of the weights of this subset is smaller than or equal to W. You cannot break an item, either pick the complete item or don’t pick it (0-1 property)
The idea is to consider all subsets of items and calculate the total weight and value of all subsets. Consider the only subsets whose total weight is smaller than W. From all such subsets, pick the maximum value subset.
The repository is a collection of open-source implementation of a variety of algorithms implemented in C++ and licensed under MIT License. The algorithms span a variety of topics from computer science, mathematics and statistics, data science, machine learning, engineering, etc.. The implementations and the associated documentation are meant to provide a learning resource for educators and students. Hence, one may find more than one implementation for the same objective but using a different algorithm strategies and optimizations.
-Online Documentation is generated from the repository source codes directly. The documentation contains all resources including source code snippets, details on execution of the programs, diagrammatic representation of program flow, and links to external resources where necessary. The documentation also introduces interactive source code with links to documentation for C++ STL library functions used. Click on Files menu to see the list of all the files documented with the code.
Documentation of Algorithms in C++ by The Algorithms Contributors is licensed under CC BY-SA 4.0
As a community developed and maintained repository, we welcome new un-plagiarized quality contributions. Please read our Contribution Guidelines.
vector vector