mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 13:53:35 +08:00
Documentation for b4b182a61d
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<map id="data_structures::queue_using_array::Queue_Array" name="data_structures::queue_using_array::Queue_Array">
|
||||
<area shape="rect" id="node1" title="Queue_Array class containing the main data and also index of head and tail of the array." alt="" coords="5,199,185,240"/>
|
||||
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/array.html" title=" " alt="" coords="29,95,161,136"/>
|
||||
<area shape="rect" id="node3" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/types/integer.html" title=" " alt="" coords="52,5,139,32"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
db27848e9a64e618488a8665cb3ae1d1
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
|
||||
-->
|
||||
<!-- Title: data_structures::queue_using_array::Queue_Array Pages: 1 -->
|
||||
<svg width="143pt" height="184pt"
|
||||
viewBox="0.00 0.00 143.00 184.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 180)">
|
||||
<title>data_structures::queue_using_array::Queue_Array</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-180 139,-180 139,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title="Queue_Array class containing the main data and also index of head and tail of the array.">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-30.5 135,-30.5 135,-0.5 0,-0.5"/>
|
||||
<text text-anchor="start" x="8" y="-18.5" font-family="Helvetica,sans-Serif" font-size="10.00">data_structures::queue</text>
|
||||
<text text-anchor="middle" x="67.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">_using_array::Queue_Array</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/array.html" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="18,-78.5 18,-108.5 117,-108.5 117,-78.5 18,-78.5"/>
|
||||
<text text-anchor="start" x="26" y="-96.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::array< int16_t,</text>
|
||||
<text text-anchor="middle" x="67.5" y="-85.5" font-family="Helvetica,sans-Serif" font-size="10.00"> max_size ></text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2->Node1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node2->Node1</title>
|
||||
<path fill="none" stroke="#9a32cd" stroke-dasharray="5,2" d="M67.5,-68.09C67.5,-55.76 67.5,-41.22 67.5,-30.73"/>
|
||||
<polygon fill="#9a32cd" stroke="#9a32cd" points="64,-68.2 67.5,-78.2 71,-68.21 64,-68.2"/>
|
||||
<text text-anchor="middle" x="75" y="-52" font-family="Helvetica,sans-Serif" font-size="10.00"> arr</text>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/types/integer.html" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="35,-156.5 35,-175.5 100,-175.5 100,-156.5 35,-156.5"/>
|
||||
<text text-anchor="middle" x="67.5" y="-163.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::int16_t</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node3->Node2 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node3->Node2</title>
|
||||
<path fill="none" stroke="#9a32cd" stroke-dasharray="5,2" d="M67.5,-146.24C67.5,-134.41 67.5,-119.38 67.5,-108.58"/>
|
||||
<polygon fill="#9a32cd" stroke="#9a32cd" points="64,-146.36 67.5,-156.36 71,-146.36 64,-146.36"/>
|
||||
<text text-anchor="middle" x="89" y="-130" font-family="Helvetica,sans-Serif" font-size="10.00"> elements</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -136,7 +136,7 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Knapsack_problem">0-1 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 don’t pick it (0-1 property)</p>
|
||||
<h3><a class="anchor" id="autotoc_md49"></a>
|
||||
<h3><a class="anchor" id="autotoc_md50"></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">Anmol</a> </dd>
|
||||
|
||||
@@ -132,7 +132,7 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Kadane%27s_algorithm">Kadane Algorithm</a> </p>
|
||||
<p>Kadane algorithm is used to find the maximum sum subarray in an array and maximum sum subarray problem is the task of finding a contiguous subarray with the largest sum</p>
|
||||
<h3><a class="anchor" id="autotoc_md53"></a>
|
||||
<h3><a class="anchor" id="autotoc_md54"></a>
|
||||
Algorithm</h3>
|
||||
<p>The simple idea of the algorithm is to search for all positive contiguous segments of the array and keep track of maximum sum contiguous segment among all positive segments(curr_sum is used for this) Each time we get a positive sum we compare it with max_sum and update max_sum if it is greater than curr_sum</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/ayush523">Ayush Singh</a> </dd></dl>
|
||||
|
||||
Reference in New Issue
Block a user