mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-16 11:32:44 +08:00
Documentation for c84c7da30f
This commit is contained in:
@@ -122,6 +122,9 @@ Namespaces</h2></td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a33e3819aa9ffec0e380383c52603b502" id="r_a33e3819aa9ffec0e380383c52603b502"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#a33e3819aa9ffec0e380383c52603b502">can_jump</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int > &nums)</td></tr>
|
||||
<tr class="memdesc:a33e3819aa9ffec0e380383c52603b502"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether the given element (default is <code>1</code>) can jump to the last index. <br /></td></tr>
|
||||
<tr class="separator:a33e3819aa9ffec0e380383c52603b502"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a127ce4403660032f53ae2e6467e5427d" id="r_a127ce4403660032f53ae2e6467e5427d"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a127ce4403660032f53ae2e6467e5427d"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a127ce4403660032f53ae2e6467e5427d">findMinimumEdge</a> (const int &infinity, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a>< T, 6 >, 6 > &graph)</td></tr>
|
||||
<tr class="memdesc:a127ce4403660032f53ae2e6467e5427d"><td class="mdescLeft"> </td><td class="mdescRight">Finds the minimum edge of the given graph. <br /></td></tr>
|
||||
@@ -132,9 +135,54 @@ Functions</h2></td></tr>
|
||||
<p>for IO operations</p>
|
||||
<p>for assert for INT_MAX for IO operations</p>
|
||||
<p>Greedy Algorithms</p>
|
||||
<p>for assert for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></p>
|
||||
<p>Greedy Algorithms</p>
|
||||
<p>for array</p>
|
||||
<p>Greedy Algorithms </p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a33e3819aa9ffec0e380383c52603b502" name="a33e3819aa9ffec0e380383c52603b502"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a33e3819aa9ffec0e380383c52603b502">◆ </a></span>can_jump()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">bool greedy_algorithms::can_jump </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int > &</td> <td class="paramname"><span class="paramname"><em>nums</em></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Checks whether the given element (default is <code>1</code>) can jump to the last index. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">nums</td><td>array of numbers containing the maximum jump (in steps) from that index </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>true if the index can be reached </dd>
|
||||
<dd>
|
||||
false if the index can NOT be reached </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 42</span> {</div>
|
||||
<div class="line"><span class="lineno"> 43</span> <span class="keywordtype">size_t</span> lastPos = nums.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() - 1;</div>
|
||||
<div class="line"><span class="lineno"> 44</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = lastPos; i != <span class="keyword">static_cast<</span><span class="keywordtype">size_t</span><span class="keyword">></span>(-1); i--) {</div>
|
||||
<div class="line"><span class="lineno"> 45</span> <span class="keywordflow">if</span> (i + nums[i] >= lastPos) {</div>
|
||||
<div class="line"><span class="lineno"> 46</span> lastPos = i;</div>
|
||||
<div class="line"><span class="lineno"> 47</span> }</div>
|
||||
<div class="line"><span class="lineno"> 48</span> }</div>
|
||||
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">return</span> lastPos == 0;</div>
|
||||
<div class="line"><span class="lineno"> 50</span>}</div>
|
||||
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d2/d90/namespacegreedy__algorithms_a33e3819aa9ffec0e380383c52603b502_cgraph.svg" width="310" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a127ce4403660032f53ae2e6467e5427d" name="a127ce4403660032f53ae2e6467e5427d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a127ce4403660032f53ae2e6467e5427d">◆ </a></span>findMinimumEdge()</h2>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
var namespacegreedy__algorithms =
|
||||
[
|
||||
[ "dijkstra", "d2/d2f/namespacegreedy__algorithms_1_1dijkstra.html", "d2/d2f/namespacegreedy__algorithms_1_1dijkstra" ],
|
||||
[ "can_jump", "d2/d90/namespacegreedy__algorithms.html#a33e3819aa9ffec0e380383c52603b502", null ],
|
||||
[ "findMinimumEdge", "d2/d90/namespacegreedy__algorithms.html#a127ce4403660032f53ae2e6467e5427d", null ]
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<map id="greedy_algorithms::can_jump" name="greedy_algorithms::can_jump">
|
||||
<area shape="rect" id="Node000001" title="Checks whether the given element (default is 1) can jump to the last index." alt="" coords="5,5,141,46"/>
|
||||
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/vector/size.html#" title=" " alt="" coords="189,13,304,38"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="141,23,173,23,173,28,141,28"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
c42fb8e2aa1ecbda76282b1d15466f0d
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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 12.1.0 (20240811.2233)
|
||||
-->
|
||||
<!-- Title: greedy_algorithms::can_jump Pages: 1 -->
|
||||
<svg width="232pt" height="39pt"
|
||||
viewBox="0.00 0.00 232.00 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
|
||||
|
||||
<style type="text/css"><![CDATA[
|
||||
.node, .edge {opacity: 0.7;}
|
||||
.node.selected, .edge.selected {opacity: 1;}
|
||||
.edge:hover path { stroke: red; }
|
||||
.edge:hover polygon { stroke: red; fill: red; }
|
||||
]]></style>
|
||||
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
|
||||
<svg id="graph" class="graph">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
|
||||
<title>greedy_algorithms::can_jump</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Checks whether the given element (default is 1) can jump to the last index.">
|
||||
<polygon fill="#999999" stroke="#666666" points="101.5,-30.5 0,-30.5 0,0 101.5,0 101.5,-30.5"/>
|
||||
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">greedy_algorithms::</text>
|
||||
<text text-anchor="middle" x="50.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">can_jump</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/size.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="224,-24.88 137.5,-24.88 137.5,-5.63 224,-5.63 224,-24.88"/>
|
||||
<text text-anchor="middle" x="180.75" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::size</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M101.97,-15.25C109.78,-15.25 117.88,-15.25 125.77,-15.25"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="125.61,-18.75 135.61,-15.25 125.61,-11.75 125.61,-18.75"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
<style type='text/css'>
|
||||
<![CDATA[
|
||||
[data-mouse-over-selected='false'] { opacity: 0.7; }
|
||||
[data-mouse-over-selected='true'] { opacity: 1.0; }
|
||||
]]>
|
||||
</style>
|
||||
<script type="application/ecmascript"><![CDATA[
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
highlightEdges();
|
||||
highlightAdjacentNodes();
|
||||
});
|
||||
]]></script>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,40 @@
|
||||
<?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 12.1.0 (20240811.2233)
|
||||
-->
|
||||
<!-- Title: greedy_algorithms::can_jump Pages: 1 -->
|
||||
<svg width="232pt" height="39pt"
|
||||
viewBox="0.00 0.00 232.00 38.50" 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 34.5)">
|
||||
<title>greedy_algorithms::can_jump</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Checks whether the given element (default is 1) can jump to the last index.">
|
||||
<polygon fill="#999999" stroke="#666666" points="101.5,-30.5 0,-30.5 0,0 101.5,0 101.5,-30.5"/>
|
||||
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">greedy_algorithms::</text>
|
||||
<text text-anchor="middle" x="50.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">can_jump</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/container/vector/size.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="#666666" points="224,-24.88 137.5,-24.88 137.5,-5.63 224,-5.63 224,-24.88"/>
|
||||
<text text-anchor="middle" x="180.75" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">std::vector::size</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1_Node000001_Node000002" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
|
||||
<path fill="none" stroke="#63b8ff" d="M101.97,-15.25C109.78,-15.25 117.88,-15.25 125.77,-15.25"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="125.61,-18.75 135.61,-15.25 125.61,-11.75 125.61,-18.75"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user