mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-28 20:43:50 +08:00
Documentation for 0931d530ae
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.5"/>
|
||||
<meta name="generator" content="Doxygen 1.9.6"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/double_factorial.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.5 -->
|
||||
<!-- Generated by Doxygen 1.9.6 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -128,8 +128,8 @@ Functions</h2></td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Compute <a href="https://en.wikipedia.org/wiki/Double_factorial" target="_blank">double factorial</a>: \(n!!\). </p>
|
||||
<p >Double factorial of a non-negative integer <code>n</code>, is defined as the product of all the integers from 1 to n that have the same parity (odd or even) as n. <br />
|
||||
<div class="textblock"><p>Compute <a href="https://en.wikipedia.org/wiki/Double_factorial" target="_blank">double factorial</a>: \(n!!\). </p>
|
||||
<p>Double factorial of a non-negative integer <code>n</code>, is defined as the product of all the integers from 1 to n that have the same parity (odd or even) as n. <br />
|
||||
It is also called as semifactorial of a number and is denoted by \(n!!\) </p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a0a3c417360400093891a9ccddaa4be26" name="a0a3c417360400093891a9ccddaa4be26"></a>
|
||||
@@ -147,7 +147,7 @@ It is also called as semifactorial of a number and is denoted by \(n!!\) </p>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >Compute double factorial using iterative method </p>
|
||||
<p>Compute double factorial using iterative method </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 17</span> {</div>
|
||||
<div class="line"><span class="lineno"> 18</span> uint64_t res = 1;</div>
|
||||
<div class="line"><span class="lineno"> 19</span> <span class="keywordflow">for</span> (uint64_t i = n;; i -= 2) {</div>
|
||||
@@ -175,7 +175,7 @@ It is also called as semifactorial of a number and is denoted by \(n!!\) </p>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >Compute double factorial using resursive method. <br />
|
||||
<p>Compute double factorial using resursive method. <br />
|
||||
Recursion can be costly for large numbers. </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 30</span> {</div>
|
||||
<div class="line"><span class="lineno"> 31</span> <span class="keywordflow">if</span> (n <= 1)</div>
|
||||
@@ -207,7 +207,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >Main function </p>
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 67</span> {</div>
|
||||
<div class="line"><span class="lineno"> 68</span> <a class="code hl_function" href="../../d7/d89/double__factorial_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>();</div>
|
||||
<div class="line"><span class="lineno"> 69</span> <span class="keywordflow">return</span> 0;</div>
|
||||
@@ -247,7 +247,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >Wrapper to run tests using both recursive and iterative implementations. The checks are only valid in debug builds due to the use of <code>assert()</code> statements. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p>Wrapper to run tests using both recursive and iterative implementations. The checks are only valid in debug builds due to the use of <code>assert()</code> statements. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">n</td><td>number to check double factorial for </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">expected</td><td>expected result </td></tr>
|
||||
@@ -282,7 +282,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >Test implementations </p>
|
||||
<p>Test implementations </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 50</span> {</div>
|
||||
<div class="line"><span class="lineno"> 51</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 1:\t n=5\t..."</span>;</div>
|
||||
<div class="line"><span class="lineno"> 52</span> <a class="code hl_function" href="../../d6/d2c/caesar__cipher_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>(5, 15);</div>
|
||||
@@ -313,7 +313,7 @@ Here is the call graph for this function:</div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../d7/d89/double__factorial_8cpp.html">double_factorial.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user