Documentation for c26eea874d

This commit is contained in:
realstealthninja
2025-05-19 11:38:33 +00:00
parent c7a9a42397
commit 14583a2f33
2829 changed files with 30266 additions and 21669 deletions

View File

@@ -4,7 +4,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.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: ciphers::HillCipher Class Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -152,19 +152,19 @@ Static Public Member Functions</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-methods" name="pri-static-methods"></a>
Static Private Member Functions</h2></td></tr>
<tr class="memitem:a629be41c1ab78850963e4ce14e1d11d9" id="r_a629be41c1ab78850963e4ce14e1d11d9"><td class="memTemplParams" colspan="2">template&lt;typename T1 , typename T2 &gt; </td></tr>
<tr class="memitem:a629be41c1ab78850963e4ce14e1d11d9" id="r_a629be41c1ab78850963e4ce14e1d11d9"><td class="memTemplParams" colspan="2">template&lt;typename T1, typename T2&gt; </td></tr>
<tr class="memitem:a629be41c1ab78850963e4ce14e1d11d9"><td class="memTemplItemLeft" align="right" valign="top">static const T2&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a629be41c1ab78850963e4ce14e1d11d9">rand_range</a> (T1 a, T1 b)</td></tr>
<tr class="memdesc:a629be41c1ab78850963e4ce14e1d11d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to generate a random integer in a given interval. <br /></td></tr>
<tr class="separator:a629be41c1ab78850963e4ce14e1d11d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a716d0313141499d16f57c0c107f04395" id="r_a716d0313141499d16f57c0c107f04395"><td class="memTemplParams" colspan="2">template&lt;typename T1 , typename T2 &gt; </td></tr>
<tr class="memitem:a716d0313141499d16f57c0c107f04395" id="r_a716d0313141499d16f57c0c107f04395"><td class="memTemplParams" colspan="2">template&lt;typename T1, typename T2&gt; </td></tr>
<tr class="memitem:a716d0313141499d16f57c0c107f04395"><td class="memTemplItemLeft" align="right" valign="top">static double&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a716d0313141499d16f57c0c107f04395">rand_range</a> (<a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; T2 &gt; *M, T1 a, T1 b)</td></tr>
<tr class="memdesc:a716d0313141499d16f57c0c107f04395"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function overload to fill a matrix with random integers in a given interval. <br /></td></tr>
<tr class="separator:a716d0313141499d16f57c0c107f04395"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7760f3665651a0a37937c79c62f219c0" id="r_a7760f3665651a0a37937c79c62f219c0"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a7760f3665651a0a37937c79c62f219c0" id="r_a7760f3665651a0a37937c79c62f219c0"><td class="memTemplParams" colspan="2">template&lt;typename T&gt; </td></tr>
<tr class="memitem:a7760f3665651a0a37937c79c62f219c0"><td class="memTemplItemLeft" align="right" valign="top">static const T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a7760f3665651a0a37937c79c62f219c0">gcd</a> (T a, T b)</td></tr>
<tr class="memdesc:a7760f3665651a0a37937c79c62f219c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute <a href="https://en.wikipedia.org/wiki/Greatest_common_divisor" target="_blank">GCD</a> of two integers using Euler's algorithm. <br /></td></tr>
<tr class="separator:a7760f3665651a0a37937c79c62f219c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad36cbcc7a458b3f3a2af0c4aa1126590" id="r_ad36cbcc7a458b3f3a2af0c4aa1126590"><td class="memItemLeft" align="right" valign="top">static const std::valarray&lt; uint8_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad36cbcc7a458b3f3a2af0c4aa1126590">mat_mul</a> (const std::valarray&lt; uint8_t &gt; &amp;vector, const <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; int &gt; &amp;key)</td></tr>
<tr class="memitem:ad36cbcc7a458b3f3a2af0c4aa1126590" id="r_ad36cbcc7a458b3f3a2af0c4aa1126590"><td class="memItemLeft" align="right" valign="top">static const std::valarray&lt; uint8_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad36cbcc7a458b3f3a2af0c4aa1126590">mat_mul</a> (const std::valarray&lt; uint8_t &gt; &amp;<a class="el" href="../../d7/dfc/classvector.html">vector</a>, const <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; int &gt; &amp;key)</td></tr>
<tr class="memdesc:ad36cbcc7a458b3f3a2af0c4aa1126590"><td class="mdescLeft">&#160;</td><td class="mdescRight">helper function to perform vector multiplication with encryption or decryption matrix <br /></td></tr>
<tr class="separator:ad36cbcc7a458b3f3a2af0c4aa1126590"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a12f727cca9e21f9539cd74b6603adf0c" id="r_a12f727cca9e21f9539cd74b6603adf0c"><td class="memItemLeft" align="right" valign="top">static char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a12f727cca9e21f9539cd74b6603adf0c">get_idx_char</a> (const uint8_t idx)</td></tr>
@@ -176,7 +176,7 @@ Static Private Member Functions</h2></td></tr>
<tr class="memitem:ad667fa0860977f6d6d443fa1dbcd80aa" id="r_ad667fa0860977f6d6d443fa1dbcd80aa"><td class="memItemLeft" align="right" valign="top">static const std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad667fa0860977f6d6d443fa1dbcd80aa">codec</a> (const std::string &amp;text, const <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; int &gt; &amp;key)</td></tr>
<tr class="memdesc:ad667fa0860977f6d6d443fa1dbcd80aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convenience function to perform block cipher operations. The operations are identical for both encryption and decryption. <br /></td></tr>
<tr class="separator:ad667fa0860977f6d6d443fa1dbcd80aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2eb58750b978a93ac5e6eb29e3e570b7" id="r_a2eb58750b978a93ac5e6eb29e3e570b7"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a2eb58750b978a93ac5e6eb29e3e570b7" id="r_a2eb58750b978a93ac5e6eb29e3e570b7"><td class="memTemplParams" colspan="2">template&lt;typename T&gt; </td></tr>
<tr class="memitem:a2eb58750b978a93ac5e6eb29e3e570b7"><td class="memTemplItemLeft" align="right" valign="top">static <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; double &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a2eb58750b978a93ac5e6eb29e3e570b7">get_inverse</a> (<a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix</a>&lt; T &gt; const &amp;A)</td></tr>
<tr class="separator:a2eb58750b978a93ac5e6eb29e3e570b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63e7b8e92dff8b9260d6d21c31ecebd0" id="r_a63e7b8e92dff8b9260d6d21c31ecebd0"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a63e7b8e92dff8b9260d6d21c31ecebd0">modulo</a> (int a, int b)</td></tr>
@@ -209,7 +209,7 @@ Static Private Member Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -285,7 +285,7 @@ Static Private Member Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -330,7 +330,7 @@ Static Private Member Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -358,7 +358,7 @@ Static Private Member Functions</h2></td></tr>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
template&lt;typename T&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
@@ -376,7 +376,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -425,7 +425,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -514,7 +514,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -560,7 +560,7 @@ template&lt;typename T &gt; </div>
<div class="line"><span class="lineno"> 363</span> <span class="keywordflow">return</span> encrypt_key;</div>
<div class="line"><span class="lineno"> 364</span> }</div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a629be41c1ab78850963e4ce14e1d11d9"><div class="ttname"><a href="#a629be41c1ab78850963e4ce14e1d11d9">ciphers::HillCipher::rand_range</a></div><div class="ttdeci">static const T2 rand_range(T1 a, T1 b)</div><div class="ttdoc">Function to generate a random integer in a given interval.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/db9/hill__cipher_8cpp_source.html#l00093">hill_cipher.cpp:93</a></div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a7760f3665651a0a37937c79c62f219c0"><div class="ttname"><a href="#a7760f3665651a0a37937c79c62f219c0">ciphers::HillCipher::gcd</a></div><div class="ttdeci">static const T gcd(T a, T b)</div><div class="ttdoc">Compute GCD of two integers using Euler's algorithm.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/db9/hill__cipher_8cpp_source.html#l00139">hill_cipher.cpp:139</a></div></div>
<div class="ttc" id="aclassciphers_1_1_hill_cipher_html_a7760f3665651a0a37937c79c62f219c0"><div class="ttname"><a href="#a7760f3665651a0a37937c79c62f219c0">ciphers::HillCipher::gcd</a></div><div class="ttdeci">static const T gcd(T a, T b)</div><div class="ttdoc">Compute GCD of two integers using Euler&#39;s algorithm.</div><div class="ttdef"><b>Definition</b> <a href="../../d7/db9/hill__cipher_8cpp_source.html#l00139">hill_cipher.cpp:139</a></div></div>
</div><!-- fragment -->
</div>
</div>
@@ -591,7 +591,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -605,7 +605,7 @@ template&lt;typename T &gt; </div>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::pair&lt;matrix&lt;int&gt;, matrix&lt;int&gt;&gt; encryption and decryption keys as a pair</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>std::pair&lt;<a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix&lt;int&gt;</a>, <a class="el" href="../../d1/dbe/lu__decomposition_8h.html#ac029b636b353cefbb18b2fcc71e427e4">matrix&lt;int&gt;</a>&gt; encryption and decryption keys as a pair</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a642f70fb54cb50b00fb6df7c3f2b120e" title="Generate encryption matrix of a given size. Larger size matrices are difficult to generate but provid...">generate_encryption_key</a> </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d7/db9/hill__cipher_8cpp_source.html#l00425">425</a> of file <a class="el" href="../../d7/db9/hill__cipher_8cpp_source.html">hill_cipher.cpp</a>.</p>
@@ -643,7 +643,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -690,7 +690,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -715,7 +715,7 @@ template&lt;typename T &gt; </div>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
template&lt;typename T&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
@@ -729,7 +729,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -825,7 +825,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -881,7 +881,7 @@ template&lt;typename T &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -902,7 +902,7 @@ template&lt;typename T &gt; </div>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T1 , typename T2 &gt; </div>
template&lt;typename T1, typename T2&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
@@ -925,7 +925,7 @@ template&lt;typename T1 , typename T2 &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -969,7 +969,7 @@ template&lt;typename T1 , typename T2 &gt; </div>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T1 , typename T2 &gt; </div>
template&lt;typename T1, typename T2&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
@@ -987,7 +987,7 @@ template&lt;typename T1 , typename T2 &gt; </div>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span><span class="mlabel">private</span></span> </td>
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel static">static</span><span class="mlabel private">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -1028,7 +1028,7 @@ template&lt;typename T1 , typename T2 &gt; </div>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../d6/d4e/namespaceciphers.html">ciphers</a></li><li class="navelem"><a class="el" href="../../d6/d26/classciphers_1_1_hill_cipher.html">HillCipher</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.12.0 </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.13.2 </li>
</ul>
</div>
</body>

View File

@@ -4,7 +4,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.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: dynamic_programming/house_robber.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -270,7 +270,7 @@ Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -285,7 +285,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 69</span> std::vector&lt;uint32_t&gt; array1 = {1, 2, 3, 1};</div>
<div class="line"><span class="lineno"> 70</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 1... &quot;</span>;</div>
<div class="line"><span class="lineno"> 71</span> assert(</div>
<div class="line"><span class="lineno"> 72</span> dynamic_programming::house_robber::houseRobber(array1, array1.size()) ==</div>
<div class="line"><span class="lineno"> 72</span> <a class="code hl_function" href="#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array1, array1.size()) ==</div>
<div class="line"><span class="lineno"> 73</span> 4); <span class="comment">// here the two non-adjacent houses that are robbed are first and</span></div>
<div class="line"><span class="lineno"> 74</span> <span class="comment">// third with total sum money as 4</span></div>
<div class="line"><span class="lineno"> 75</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
@@ -295,7 +295,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 79</span> std::vector&lt;uint32_t&gt; array2 = {6, 7, 1, 3, 8, 2, 4};</div>
<div class="line"><span class="lineno"> 80</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 2... &quot;</span>;</div>
<div class="line"><span class="lineno"> 81</span> assert(</div>
<div class="line"><span class="lineno"> 82</span> dynamic_programming::house_robber::houseRobber(array2, array2.size()) ==</div>
<div class="line"><span class="lineno"> 82</span> <a class="code hl_function" href="#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array2, array2.size()) ==</div>
<div class="line"><span class="lineno"> 83</span> 19); <span class="comment">// here the four non-adjacent houses that are robbed are first,</span></div>
<div class="line"><span class="lineno"> 84</span> <span class="comment">// third, fifth and seventh with total sum money as 19</span></div>
<div class="line"><span class="lineno"> 85</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
@@ -305,7 +305,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 89</span> std::vector&lt;uint32_t&gt; array3 = {};</div>
<div class="line"><span class="lineno"> 90</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 3... &quot;</span>;</div>
<div class="line"><span class="lineno"> 91</span> assert(</div>
<div class="line"><span class="lineno"> 92</span> dynamic_programming::house_robber::houseRobber(array3, array3.size()) ==</div>
<div class="line"><span class="lineno"> 92</span> <a class="code hl_function" href="#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array3, array3.size()) ==</div>
<div class="line"><span class="lineno"> 93</span> 0); <span class="comment">// since there is no house no money can be robbed</span></div>
<div class="line"><span class="lineno"> 94</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 95</span> </div>
@@ -314,11 +314,12 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 98</span> std::vector&lt;uint32_t&gt; array4 = {2, 7, 9, 3, 1};</div>
<div class="line"><span class="lineno"> 99</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 4... &quot;</span>;</div>
<div class="line"><span class="lineno"> 100</span> assert(</div>
<div class="line"><span class="lineno"> 101</span> dynamic_programming::house_robber::houseRobber(array4, array4.size()) ==</div>
<div class="line"><span class="lineno"> 101</span> <a class="code hl_function" href="#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array4, array4.size()) ==</div>
<div class="line"><span class="lineno"> 102</span> 12); <span class="comment">// here the three non-adjacent houses that are robbed are first,</span></div>
<div class="line"><span class="lineno"> 103</span> <span class="comment">// third and fifth with total sum money as 12</span></div>
<div class="line"><span class="lineno"> 104</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 105</span>}</div>
<div class="ttc" id="ahouse__robber_8cpp_html_a1e497c3e3f169afe5baaae6a5d40cbc8"><div class="ttname"><a href="#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a></div><div class="ttdeci">std::uint32_t houseRobber(const std::vector&lt; uint32_t &gt; &amp;money, const uint32_t &amp;n)</div><div class="ttdoc">The main function that implements the House Robber algorithm using dynamic programming.</div><div class="ttdef"><b>Definition</b> <a href="../../d6/d26/house__robber_8cpp_source.html#l00036">house_robber.cpp:36</a></div></div>
</div><!-- fragment -->
</div>
</div>
@@ -328,7 +329,7 @@ Functions</h2></td></tr>
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_8a20dd5bfd5341a725342bf72b6b686f.html">dynamic_programming</a></li><li class="navelem"><a class="el" href="../../d6/d26/house__robber_8cpp.html">house_robber.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.12.0 </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.13.2 </li>
</ul>
</div>
</body>

View File

@@ -1,6 +1,6 @@
var house__robber_8cpp =
[
[ "houseRobber", "d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8", null ],
[ "dynamic_programming::house_robber::houseRobber", "d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8", null ],
[ "main", "d6/d26/house__robber_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
[ "test", "d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ]
];

View File

@@ -4,7 +4,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.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: dynamic_programming/house_robber.cpp Source File</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -124,7 +124,8 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div class="headertitle"><div class="title">house_robber.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d6/d26/house__robber_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<a href="../../d6/d26/house__robber_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="preprocessor">#include &lt;cassert&gt;</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;climits&gt;</span> </div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;cstdint&gt;</span> </div>
@@ -159,7 +160,7 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span>} <span class="comment">// namespace house_robber</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span>} <span class="comment">// namespace dynamic_programming</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span></div>
<div class="foldopen" id="foldopen00066" data-start="{" data-end="}">
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="../../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 66</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="comment">// Test 1</span></div>
@@ -167,7 +168,7 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> std::vector&lt;uint32_t&gt; array1 = {1, 2, 3, 1};</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 1... &quot;</span>;</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> assert(</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> dynamic_programming::house_robber::houseRobber(array1, array1.size()) ==</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array1, array1.size()) ==</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> 4); <span class="comment">// here the two non-adjacent houses that are robbed are first and</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="comment">// third with total sum money as 4</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
@@ -177,7 +178,7 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> std::vector&lt;uint32_t&gt; array2 = {6, 7, 1, 3, 8, 2, 4};</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 2... &quot;</span>;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> assert(</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> dynamic_programming::house_robber::houseRobber(array2, array2.size()) ==</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array2, array2.size()) ==</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> 19); <span class="comment">// here the four non-adjacent houses that are robbed are first,</span></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="comment">// third, fifth and seventh with total sum money as 19</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
@@ -187,7 +188,7 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> std::vector&lt;uint32_t&gt; array3 = {};</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 3... &quot;</span>;</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> assert(</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> dynamic_programming::house_robber::houseRobber(array3, array3.size()) ==</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array3, array3.size()) ==</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> 0); <span class="comment">// since there is no house no money can be robbed</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
@@ -196,13 +197,13 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> std::vector&lt;uint32_t&gt; array4 = {2, 7, 9, 3, 1};</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 4... &quot;</span>;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> assert(</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> dynamic_programming::house_robber::houseRobber(array4, array4.size()) ==</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#a1e497c3e3f169afe5baaae6a5d40cbc8">dynamic_programming::house_robber::houseRobber</a>(array4, array4.size()) ==</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> 12); <span class="comment">// here the three non-adjacent houses that are robbed are first,</span></div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="comment">// third and fifth with total sum money as 12</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> std::cout &lt;&lt; <span class="stringliteral">&quot;passed&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span>}</div>
</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span></div>
<div class="foldopen" id="foldopen00111" data-start="{" data-end="}">
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"><a class="line" href="../../d6/d26/house__robber_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 111</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <a class="code hl_function" href="../../d6/d26/house__robber_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
@@ -220,7 +221,7 @@ $(function(){initNavTree('d6/d26/house__robber_8cpp_source.html','../../'); init
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../dir_8a20dd5bfd5341a725342bf72b6b686f.html">dynamic_programming</a></li><li class="navelem"><a class="el" href="../../d6/d26/house__robber_8cpp.html">house_robber.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.12.0 </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.13.2 </li>
</ul>
</div>
</body>