Documentation for b0b183df92

This commit is contained in:
github-actions
2023-06-12 16:22:49 +00:00
parent 8b1f36d69a
commit 26f1eee566
104 changed files with 4624 additions and 2690 deletions

View File

@@ -142,7 +142,7 @@ Functions</h2></td></tr>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Implementation of [0-1 <a class="el" href="../../d7/daf/namespace_knapsack.html" title="Implementation of 0-1 Knapsack problem.">Knapsack</a> Problem] (<a href="https://en.wikipedia.org/wiki/Knapsack_problem">https://en.wikipedia.org/wiki/Knapsack_problem</a>) </p>
<p>Given weights and values of n items, put these items in a knapsack of capacity <code>W</code> to get the maximum total value in the knapsack. In other words, given two integer arrays <code>val[0..n-1]</code> and <code>wt[0..n-1]</code> 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 <code>val[]</code> 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 dont pick it (0-1 property)</p>
<h3><a class="anchor" id="autotoc_md68"></a>
<h3><a class="anchor" id="autotoc_md69"></a>
Algorithm</h3>
<p>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 <code>W</code>. From all such subsets, pick the maximum value subset.</p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Anmol3299" target="_blank">Anmol</a> </dd>