mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-07-17 03:51:27 +08:00
Documentation for e3f0551f98
This commit is contained in:
@@ -151,6 +151,12 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:ac5803413618fcfb922cb32c6db0fc864"><td class="memTemplItemLeft" align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#ac5803413618fcfb922cb32c6db0fc864">cylinder_surface_area</a> (T radius, T height)</td></tr>
|
||||
<tr class="memdesc:ac5803413618fcfb922cb32c6db0fc864"><td class="mdescLeft"> </td><td class="mdescRight">surface area of a <a href="https://en.wikipedia.org/wiki/Cylinder" target="_blank">cylinder</a> (2 * pi * r * h + 2 * pi * r^2) <br /></td></tr>
|
||||
<tr class="separator:ac5803413618fcfb922cb32c6db0fc864"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af05567415a9ea36c254b54e3d5a2152a"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a">sum_of_divisor</a> (int num)</td></tr>
|
||||
<tr class="memdesc:af05567415a9ea36c254b54e3d5a2152a"><td class="mdescLeft"> </td><td class="mdescRight">Function to calculate the sum of all the proper divisor of an integer. <br /></td></tr>
|
||||
<tr class="separator:af05567415a9ea36c254b54e3d5a2152a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a8e6eede206201db0d1dbb618fa969bec"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#a8e6eede206201db0d1dbb618fa969bec">are_amicable</a> (int x, int y)</td></tr>
|
||||
<tr class="memdesc:a8e6eede206201db0d1dbb618fa969bec"><td class="mdescLeft"> </td><td class="mdescRight">Function to check whether the pair is amicable or not. <br /></td></tr>
|
||||
<tr class="separator:a8e6eede206201db0d1dbb618fa969bec"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a6c72f756a7bf1b9043c357e3fe7814ca"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#a6c72f756a7bf1b9043c357e3fe7814ca">is_factorial</a> (uint64_t n)</td></tr>
|
||||
<tr class="memdesc:a6c72f756a7bf1b9043c357e3fe7814ca"><td class="mdescLeft"> </td><td class="mdescRight">Function to check if the given number is factorial of some number or not. <br /></td></tr>
|
||||
<tr class="separator:a6c72f756a7bf1b9043c357e3fe7814ca"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -388,6 +394,55 @@ Here is the call graph for this function:</div>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../dd/d47/namespacemath_abf7f2a6d91f1ca6c89698792aea3f188_cgraph.svg" width="320" height="36"><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="a8e6eede206201db0d1dbb618fa969bec" name="a8e6eede206201db0d1dbb618fa969bec"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a8e6eede206201db0d1dbb618fa969bec">◆ </a></span>are_amicable()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">bool math::are_amicable </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>x</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>y</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Function to check whether the pair is amicable or not. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">x</td><td>First number. </td></tr>
|
||||
<tr><td class="paramname">y</td><td>Second number. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the pair is amicable </dd>
|
||||
<dd>
|
||||
<code>false</code> if the pair is not amicable </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 58</span> {</div>
|
||||
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">return</span> (<a class="code hl_function" href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a">sum_of_divisor</a>(x) == y) && (<a class="code hl_function" href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a">sum_of_divisor</a>(y) == x);</div>
|
||||
<div class="line"><span class="lineno"> 60</span>}</div>
|
||||
<div class="ttc" id="anamespacemath_html_af05567415a9ea36c254b54e3d5a2152a"><div class="ttname"><a href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a">math::sum_of_divisor</a></div><div class="ttdeci">int sum_of_divisor(int num)</div><div class="ttdoc">Function to calculate the sum of all the proper divisor of an integer.</div><div class="ttdef"><b>Definition</b> check_amicable_pair.cpp:31</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="../../dd/d47/namespacemath_a8e6eede206201db0d1dbb618fa969bec_cgraph.svg" width="340" height="36"><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="ae1ca505751f5a6d3977b86372cfe75ea" name="ae1ca505751f5a6d3977b86372cfe75ea"></a>
|
||||
@@ -1945,6 +2000,52 @@ template<typename T > </div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="af05567415a9ea36c254b54e3d5a2152a" name="af05567415a9ea36c254b54e3d5a2152a"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#af05567415a9ea36c254b54e3d5a2152a">◆ </a></span>sum_of_divisor()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">int math::sum_of_divisor </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">int </td>
|
||||
<td class="paramname"><em>num</em></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Function to calculate the sum of all the proper divisor of an integer. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">num</td><td>selected number. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Sum of the proper divisor of the number. </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 31</span> {</div>
|
||||
<div class="line"><span class="lineno"> 32</span> <span class="comment">// Variable to store the sum of all proper divisors.</span></div>
|
||||
<div class="line"><span class="lineno"> 33</span> <span class="keywordtype">int</span> sum = 1;</div>
|
||||
<div class="line"><span class="lineno"> 34</span> <span class="comment">// Below loop condition helps to reduce Time complexity by a factor of</span></div>
|
||||
<div class="line"><span class="lineno"> 35</span> <span class="comment">// square root of the number.</span></div>
|
||||
<div class="line"><span class="lineno"> 36</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> div = 2; div * div <= num; ++div) {</div>
|
||||
<div class="line"><span class="lineno"> 37</span> <span class="comment">// Check 'div' is divisor of 'num'.</span></div>
|
||||
<div class="line"><span class="lineno"> 38</span> <span class="keywordflow">if</span> (num % div == 0) {</div>
|
||||
<div class="line"><span class="lineno"> 39</span> <span class="comment">// If both divisor are same, add once to 'sum'</span></div>
|
||||
<div class="line"><span class="lineno"> 40</span> <span class="keywordflow">if</span> (div == (num / div)) {</div>
|
||||
<div class="line"><span class="lineno"> 41</span> sum += div;</div>
|
||||
<div class="line"><span class="lineno"> 42</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><span class="lineno"> 43</span> <span class="comment">// If both divisor are not the same, add both to 'sum'.</span></div>
|
||||
<div class="line"><span class="lineno"> 44</span> sum += (div + (num / div));</div>
|
||||
<div class="line"><span class="lineno"> 45</span> }</div>
|
||||
<div class="line"><span class="lineno"> 46</span> }</div>
|
||||
<div class="line"><span class="lineno"> 47</span> }</div>
|
||||
<div class="line"><span class="lineno"> 48</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a>;</div>
|
||||
<div class="line"><span class="lineno"> 49</span>}</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a50936ee98f4d40f17823befc65a32aec" name="a50936ee98f4d40f17823befc65a32aec"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a50936ee98f4d40f17823befc65a32aec">◆ </a></span>test_eval()</h2>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ var namespacemath =
|
||||
[ "Point", "de/d4f/structmath_1_1_point.html", null ],
|
||||
[ "aliquot_sum", "dd/d47/namespacemath.html#ab37f3a7302a84179aae682c79d8390bf", null ],
|
||||
[ "approximate_pi", "dd/d47/namespacemath.html#abf7f2a6d91f1ca6c89698792aea3f188", null ],
|
||||
[ "are_amicable", "dd/d47/namespacemath.html#a8e6eede206201db0d1dbb618fa969bec", null ],
|
||||
[ "binomialCoeffSum", "dd/d47/namespacemath.html#ae1ca505751f5a6d3977b86372cfe75ea", null ],
|
||||
[ "circle_area", "dd/d47/namespacemath.html#a40e36c67da78d2131408c57ee091ad75", null ],
|
||||
[ "circle_perimeter", "dd/d47/namespacemath.html#ad0acf82b7bc920182bf8322d1e103953", null ],
|
||||
@@ -37,6 +38,7 @@ var namespacemath =
|
||||
[ "sphere_volume", "dd/d47/namespacemath.html#a34d66a77c19ce9b8b3a3d14352b34551", null ],
|
||||
[ "square_area", "dd/d47/namespacemath.html#a971ce57e368f2f631cf1f4ff3f864049", null ],
|
||||
[ "square_perimeter", "dd/d47/namespacemath.html#a9236348755183644f1225e162d01ab14", null ],
|
||||
[ "sum_of_divisor", "dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a", null ],
|
||||
[ "test_eval", "dd/d47/namespacemath.html#a50936ee98f4d40f17823befc65a32aec", null ],
|
||||
[ "triangle_area", "dd/d47/namespacemath.html#ab3b920cc56442abd92279ba23b50f4dc", null ],
|
||||
[ "triangle_perimeter", "dd/d47/namespacemath.html#a3d1e4db743b189f309327572663415f3", null ],
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<map id="math::are_amicable" name="math::are_amicable">
|
||||
<area shape="rect" id="Node000001" title="Function to check whether the pair is amicable or not." alt="" coords="5,5,141,31"/>
|
||||
<area shape="rect" id="Node000002" href="$dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a" title="Function to calculate the sum of all the proper divisor of an integer." alt="" coords="189,5,335,31"/>
|
||||
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="141,16,174,16,174,21,141,21"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
5a1e76eff5b60a59fdd7eae43d589d1a
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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 8.0.5 (20230430.1635)
|
||||
-->
|
||||
<!-- Title: math::are_amicable Pages: 1 -->
|
||||
<svg width="255pt" height="27pt"
|
||||
viewBox="0.00 0.00 255.25 27.25" 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" onload="init(evt)">
|
||||
<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 23.25)">
|
||||
<title>math::are_amicable</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Function to check whether the pair is amicable or not.">
|
||||
<polygon fill="#999999" stroke="#666666" points="101.5,-19.25 0,-19.25 0,0 101.5,0 101.5,-19.25"/>
|
||||
<text text-anchor="middle" x="50.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">math::are_amicable</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a" target="_top" xlink:title="Function to calculate the sum of all the proper divisor of an integer.">
|
||||
<polygon fill="white" stroke="#666666" points="247.25,-19.25 137.5,-19.25 137.5,0 247.25,0 247.25,-19.25"/>
|
||||
<text text-anchor="middle" x="192.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">math::sum_of_divisor</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.76,-9.62C109.82,-9.62 118.25,-9.62 126.59,-9.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="126.46,-13.13 136.46,-9.62 126.46,-6.13 126.46,-13.13"/>
|
||||
</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,39 @@
|
||||
<?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 8.0.5 (20230430.1635)
|
||||
-->
|
||||
<!-- Title: math::are_amicable Pages: 1 -->
|
||||
<svg width="255pt" height="27pt"
|
||||
viewBox="0.00 0.00 255.25 27.25" 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 23.25)">
|
||||
<title>math::are_amicable</title>
|
||||
<!-- Node1 -->
|
||||
<g id="Node000001" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_Node000001"><a xlink:title="Function to check whether the pair is amicable or not.">
|
||||
<polygon fill="#999999" stroke="#666666" points="101.5,-19.25 0,-19.25 0,0 101.5,0 101.5,-19.25"/>
|
||||
<text text-anchor="middle" x="50.75" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">math::are_amicable</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node2 -->
|
||||
<g id="Node000002" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_Node000002"><a xlink:href="../../dd/d47/namespacemath.html#af05567415a9ea36c254b54e3d5a2152a" target="_top" xlink:title="Function to calculate the sum of all the proper divisor of an integer.">
|
||||
<polygon fill="white" stroke="#666666" points="247.25,-19.25 137.5,-19.25 137.5,0 247.25,0 247.25,-19.25"/>
|
||||
<text text-anchor="middle" x="192.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">math::sum_of_divisor</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.76,-9.62C109.82,-9.62 118.25,-9.62 126.59,-9.62"/>
|
||||
<polygon fill="#63b8ff" stroke="#63b8ff" points="126.46,-13.13 136.46,-9.62 126.46,-6.13 126.46,-13.13"/>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user