Documentation for 341ed50da8
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: data_structures/binary_search_tree.cpp Pages: 1 -->
|
||||
<svg width="123pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: gram_schmidt Namespace Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d0f/namespacegram__schmidt.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,22 +90,21 @@ $(document).ready(function(){initNavTree('d4/d0f/namespacegram__schmidt.html','.
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">gram_schmidt Namespace Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">gram_schmidt Namespace Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Functions for <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process">Gram Schmidt Orthogonalisation Process</a>
|
||||
<p>Functions for <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process" target="_blank">Gram Schmidt Orthogonalisation Process</a>
|
||||
<a href="../../d4/d0f/namespacegram__schmidt.html#details">More...</a></p>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Functions for <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process">Gram Schmidt Orthogonalisation Process</a> </p>
|
||||
<div class="textblock"><p >Functions for <a href="https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process" target="_blank">Gram Schmidt Orthogonalisation Process</a> </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../d4/d0f/namespacegram__schmidt.html">gram_schmidt</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: Minimum Namespace Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d12/namespace_minimum.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,23 +90,22 @@ $(document).ready(function(){initNavTree('d4/d12/namespace_minimum.html','../../
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Minimum Namespace Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">Minimum Namespace Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Implementation of <a href="https://en.wikipedia.org/wiki/Edit_distance">Minimum Edit Distance</a> algorithm.
|
||||
<p>Implementation of <a href="https://en.wikipedia.org/wiki/Edit_distance" target="_blank">Minimum Edit Distance</a> algorithm.
|
||||
<a href="../../d4/d12/namespace_minimum.html#details">More...</a></p>
|
||||
<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/Edit_distance">Minimum Edit Distance</a> algorithm. </p>
|
||||
<p>Edit Distance </p>
|
||||
<div class="textblock"><p >Implementation of <a href="https://en.wikipedia.org/wiki/Edit_distance" target="_blank">Minimum Edit Distance</a> algorithm. </p>
|
||||
<p >Edit Distance </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../d4/d12/namespace_minimum.html">Minimum</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: bidirectional_dijkstra Namespace Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d13/namespacebidirectional__dijkstra.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,22 +90,21 @@ $(document).ready(function(){initNavTree('d4/d13/namespacebidirectional__dijkstr
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">bidirectional_dijkstra Namespace Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">bidirectional_dijkstra Namespace Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Functions for <a href="https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra">Bidirectional Dijkstra Shortest Path</a> algorithm.
|
||||
<p>Functions for <a href="https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra" target="_blank">Bidirectional Dijkstra Shortest Path</a> algorithm.
|
||||
<a href="../../d4/d13/namespacebidirectional__dijkstra.html#details">More...</a></p>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Functions for <a href="https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra">Bidirectional Dijkstra Shortest Path</a> algorithm. </p>
|
||||
<div class="textblock"><p >Functions for <a href="https://www.coursera.org/learn/algorithms-on-graphs/lecture/7ml18/bidirectional-dijkstra" target="_blank">Bidirectional Dijkstra Shortest Path</a> algorithm. </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../d4/d13/namespacebidirectional__dijkstra.html">bidirectional_dijkstra</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: hamming_distance Namespace Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d1c/namespacehamming__distance.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,22 +90,21 @@ $(document).ready(function(){initNavTree('d4/d1c/namespacehamming__distance.html
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">hamming_distance Namespace Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">hamming_distance Namespace Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a> implementation.
|
||||
<p>Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> implementation.
|
||||
<a href="../../d4/d1c/namespacehamming__distance.html#details">More...</a></p>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a> implementation. </p>
|
||||
<div class="textblock"><p >Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> implementation. </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../d4/d1c/namespacehamming__distance.html">hamming_distance</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: Member List</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d8/d72/class_r_btree.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,32 +90,31 @@ $(document).ready(function(){initNavTree('d8/d72/class_r_btree.html','../../');
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">RBtree Member List</div> </div>
|
||||
<div class="headertitle"><div class="title">RBtree Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>del</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>delfix</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>delfix</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>disp</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>display</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>display</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>insert</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>insertfix</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>insertfix</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>leftrotate</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>q</b> (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>q</b> (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>RBtree</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>rightrotate</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>rightrotate</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>root</b> (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>search</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>search</b>() (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>successor</b>(node *) (defined in <a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a>)</td><td class="entry"><a class="el" href="../../d8/d72/class_r_btree.html">RBtree</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: Member List</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d2/d05/class_min_heap.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,33 +90,32 @@ $(document).ready(function(){initNavTree('d2/d05/class_min_heap.html','../../');
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">MinHeap Member List</div> </div>
|
||||
<div class="headertitle"><div class="title">MinHeap Member List</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>This is the complete list of members for <a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a88b4aa3e66392a3eabbf2517a9a79a02">capacity</a></td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aa7f726cc6327955d22871592227432f5">decreaseKey</a>(int i, int new_val)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aa7f726cc6327955d22871592227432f5">decreaseKey</a>(int i, int new_val)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a37ac126eabb0c3ce04047172abccca29">deleteKey</a>(int i)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a4014f1edaed0bd7db0c0d2ca53228980">extractMin</a>()</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a4014f1edaed0bd7db0c0d2ca53228980">extractMin</a>()</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a336ac71f0d857269fe9a98058a3cd130">getMin</a>()</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a34a93a87967308eb516328c0aca3c48e">harr</a></td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a34a93a87967308eb516328c0aca3c48e">harr</a></td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#ae4d358bf063bb196a1945b3fb99b4913">heap_size</a></td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aef78f3384f5a0ae880ad0883d2d44b82">insertKey</a>(int k)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aef78f3384f5a0ae880ad0883d2d44b82">insertKey</a>(int k)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aa8c6c141e3de664819686aa637e1afca">left</a>(int i)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a078cb888e642bb1f95dd0e03f0a35820">MinHeap</a>(int cap)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
|
||||
<tr class="odd"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#a078cb888e642bb1f95dd0e03f0a35820">MinHeap</a>(int cap)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#aaef438c1056492cb62c4a4d9035b5cad">MinHeapify</a>(int)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>parent</b>(int i) (defined in <a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a>)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>parent</b>(int i) (defined in <a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a>)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html#ac760b85cf90265b8d674b942a43fb70e">right</a>(int i)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td class="entry"><b>~MinHeap</b>() (defined in <a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a>)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>~MinHeap</b>() (defined in <a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a>)</td><td class="entry"><a class="el" href="../../d2/d05/class_min_heap.html">MinHeap</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: sorting/merge_insertion_sort.cpp Pages: 1 -->
|
||||
<svg width="394pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/least_common_multiple.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d21/least__common__multiple_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -92,8 +92,7 @@ $(document).ready(function(){initNavTree('d4/d21/least__common__multiple_8cpp.ht
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">least_common_multiple.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">least_common_multiple.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
@@ -105,7 +104,7 @@ Include dependency graph for least_common_multiple.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a8ba1fc66e4134ab25b2602b323150563"><td class="memItemLeft" align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a> (unsigned int x, unsigned int y)</td></tr>
|
||||
<tr class="separator:a8ba1fc66e4134ab25b2602b323150563"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -117,10 +116,10 @@ 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>Copyright 2020 </p><dl class="section author"><dt>Author</dt><dd>tjgurwara99</dd></dl>
|
||||
<div class="textblock"><p >Copyright 2020 </p><dl class="section author"><dt>Author</dt><dd>tjgurwara99</dd></dl>
|
||||
<p>A basic implementation of LCM function </p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a8ba1fc66e4134ab25b2602b323150563"></a>
|
||||
<a id="a8ba1fc66e4134ab25b2602b323150563" name="a8ba1fc66e4134ab25b2602b323150563"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a8ba1fc66e4134ab25b2602b323150563">◆ </a></span>gcd()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -145,33 +144,39 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for finding greatest common divisor of two numbers. @params two integers x and y whose gcd we want to find. </p><dl class="section return"><dt>Returns</dt><dd>greatest common divisor of x and y. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  {</div>
|
||||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keywordflow">if</span> (x == 0) {</div>
|
||||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  <span class="keywordflow">return</span> y;</div>
|
||||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  }</div>
|
||||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">if</span> (y == 0) {</div>
|
||||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keywordflow">return</span> x;</div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  }</div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordflow">if</span> (x == y) {</div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordflow">return</span> x;</div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  }</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordflow">if</span> (x > y) {</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="comment">// The following is valid because we have checked whether y == 0</span></div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  </div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> temp = x / y;</div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordflow">return</span> <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(y, x - temp * y);</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  }</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="comment">// Again the following is valid because we have checked whether x == 0</span></div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  </div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> temp = y / x;</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">return</span> <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(x, y - temp * x);</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> }</div>
|
||||
<p >Function for finding greatest common divisor of two numbers. @params two integers x and y whose gcd we want to find. </p><dl class="section return"><dt>Returns</dt><dd>greatest common divisor of x and y. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> {</div>
|
||||
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <span class="keywordflow">if</span> (x == 0) {</div>
|
||||
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="keywordflow">return</span> y;</div>
|
||||
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> }</div>
|
||||
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keywordflow">if</span> (y == 0) {</div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keywordflow">return</span> x;</div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> }</div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">if</span> (x == y) {</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">return</span> x;</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> }</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keywordflow">if</span> (x > y) {</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="comment">// The following is valid because we have checked whether y == 0</span></div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> temp = x / y;</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(y, x - temp * y);</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> }</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="comment">// Again the following is valid because we have checked whether x == 0</span></div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> temp = y / x;</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(x, y - temp * x);</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span>}</div>
|
||||
<div class="ttc" id="aleast__common__multiple_8cpp_html_a8ba1fc66e4134ab25b2602b323150563"><div class="ttname"><a href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a></div><div class="ttdeci">unsigned int gcd(unsigned int x, unsigned int y)</div><div class="ttdef"><b>Definition:</b> least_common_multiple.cpp:16</div></div>
|
||||
</div><!-- fragment -->
|
||||
</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="../../d4/d21/least__common__multiple_8cpp_a8ba1fc66e4134ab25b2602b323150563_cgraph.svg" width="55" height="62"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8d0e241db517813725e721a152e3a25"></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8d0e241db517813725e721a152e3a25" name="aa8d0e241db517813725e721a152e3a25"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8d0e241db517813725e721a152e3a25">◆ </a></span>lcm()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -196,20 +201,20 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for finding the least common multiple of two numbers. @params integer x and y whose lcm we want to find. </p><dl class="section return"><dt>Returns</dt><dd>lcm of x and y using the relation x * y = gcd(x, y) * lcm(x, y) </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  {</div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">return</span> x / <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(x, y) * y;</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> }</div>
|
||||
<p >Function for finding the least common multiple of two numbers. @params integer x and y whose lcm we want to find. </p><dl class="section return"><dt>Returns</dt><dd>lcm of x and y using the relation x * y = gcd(x, y) * lcm(x, y) </dd></dl>
|
||||
<div class="fragment"><div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> {</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">return</span> x / <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563">gcd</a>(x, y) * y;</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span>}</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="../../d4/d21/least__common__multiple_8cpp_aa8d0e241db517813725e721a152e3a25_cgraph.svg" width="146" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d21/least__common__multiple_8cpp_aa8d0e241db517813725e721a152e3a25_cgraph.svg" width="146" height="62"><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="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -224,11 +229,11 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  {</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>();</div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> }</div>
|
||||
<p >Main function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> {</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>();</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span>}</div>
|
||||
<div class="ttc" id="aleast__common__multiple_8cpp_html_a88ec9ad42717780d6caaff9d3d6977f9"><div class="ttname"><a href="../../d4/d21/least__common__multiple_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a></div><div class="ttdeci">void tests()</div><div class="ttdef"><b>Definition:</b> least_common_multiple.cpp:50</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -239,7 +244,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a88ec9ad42717780d6caaff9d3d6977f9"></a>
|
||||
<a id="a88ec9ad42717780d6caaff9d3d6977f9" name="a88ec9ad42717780d6caaff9d3d6977f9"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a88ec9ad42717780d6caaff9d3d6977f9">◆ </a></span>tests()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -253,31 +258,31 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for testing the <a class="el" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm()</a> functions with some assert statements. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  {</div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">// First test on lcm(5,10) == 10</span></div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 5 and 10 is 10 but lcm function gives a different "</span></div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="stringliteral">"result.\n"</span>,</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(5, 10) == 10));</div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"First assertion passes: LCM of 5 and 10 is "</span> << <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(5, 10)</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  </div>
|
||||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="comment">// Second test on lcm(2,3) == 6 as 2 and 3 are coprime (prime in fact)</span></div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 2 and 3 is 6 but lcm function gives a different "</span></div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="stringliteral">"result.\n"</span>,</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(2, 3) == 6));</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Second assertion passes: LCM of 2 and 3 is "</span> << <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(2, 3)</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  </div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Testing an integer overflow.</span></div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// The algorithm should work as long as the result fits into integer.</span></div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 987654321 and 987654321 is 987654321 but lcm function"</span></div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="stringliteral">" gives a different result.\n"</span>,</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(987654321, 987654321) == 987654321));</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Third assertion passes: LCM of 987654321 and 987654321 is "</span></div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  << <a class="code" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(987654321, 987654321)</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> }</div>
|
||||
<p >Function for testing the <a class="el" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm()</a> functions with some assert statements. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> {</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="comment">// First test on lcm(5,10) == 10</span></div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 5 and 10 is 10 but lcm function gives a different "</span></div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="stringliteral">"result.\n"</span>,</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(5, 10) == 10));</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</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">"First assertion passes: LCM of 5 and 10 is "</span> << <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(5, 10)</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="comment">// Second test on lcm(2,3) == 6 as 2 and 3 are coprime (prime in fact)</span></div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 2 and 3 is 6 but lcm function gives a different "</span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="stringliteral">"result.\n"</span>,</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(2, 3) == 6));</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</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">"Second assertion passes: LCM of 2 and 3 is "</span> << <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(2, 3)</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="comment">// Testing an integer overflow.</span></div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="comment">// The algorithm should work as long as the result fits into integer.</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> assert(((<span class="keywordtype">void</span>)<span class="stringliteral">"LCM of 987654321 and 987654321 is 987654321 but lcm function"</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="stringliteral">" gives a different result.\n"</span>,</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(987654321, 987654321) == 987654321));</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</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">"Third assertion passes: LCM of 987654321 and 987654321 is "</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> << <a class="code hl_function" href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a>(987654321, 987654321)</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="aleast__common__multiple_8cpp_html_aa8d0e241db517813725e721a152e3a25"><div class="ttname"><a href="../../d4/d21/least__common__multiple_8cpp.html#aa8d0e241db517813725e721a152e3a25">lcm</a></div><div class="ttdeci">unsigned int lcm(unsigned int x, unsigned int y)</div><div class="ttdef"><b>Definition:</b> least_common_multiple.cpp:43</div></div>
|
||||
@@ -296,7 +301,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="../../d4/d21/least__common__multiple_8cpp.html">least_common_multiple.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1 +1 @@
|
||||
a61ed673e3da231de39e9d2d50c3bf9f
|
||||
69c722ea4a33192fef0ae885227de1f1
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: tests Pages: 1 -->
|
||||
<svg width="205pt" height="66pt"
|
||||
@@ -63,5 +63,11 @@
|
||||
<path fill="none" stroke="midnightblue" d="M117.31,-10C127.75,-10 141.83,-10 153.95,-10"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="153.96,-13.5 163.96,-10 153.95,-6.5 153.96,-13.5"/>
|
||||
</g>
|
||||
<!-- Node4->Node4 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>Node4->Node4</title>
|
||||
<path fill="none" stroke="midnightblue" d="M168.48,-19.76C162.63,-28.57 166.64,-38 180.5,-38 188.95,-38 193.74,-34.5 194.86,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="198.21,-28.7 192.52,-19.76 191.39,-30.29 198.21,-28.7"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,3 @@
|
||||
<map id="gcd" name="gcd">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,29,49,56"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
63194f545c045f973d0472cef162735b
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: gcd Pages: 1 -->
|
||||
<svg width="41pt" height="46pt"
|
||||
viewBox="0.00 0.00 41.00 46.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 42)">
|
||||
<title>gcd</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-42 37,-42 37,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title=" ">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 33,-19.5 33,-0.5 0,-0.5"/>
|
||||
<text text-anchor="middle" x="16.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">gcd</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<path fill="none" stroke="midnightblue" d="M11.57,-19.76C9.17,-28.57 10.81,-38 16.5,-38 19.97,-38 21.93,-34.5 22.39,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="25.87,-29.38 21.43,-19.76 18.9,-30.05 25.87,-29.38"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,4 +1,4 @@
|
||||
<map id="lcm" name="lcm">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,5,48,32"/>
|
||||
<area shape="rect" id="node2" href="$d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563" title=" " alt="" coords="96,5,140,32"/>
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,29,48,56"/>
|
||||
<area shape="rect" id="node2" href="$d4/d21/least__common__multiple_8cpp.html#a8ba1fc66e4134ab25b2602b323150563" title=" " alt="" coords="96,29,140,56"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
31d2c67966697e5578929cea1691d489
|
||||
1f3bc8ef863ff2657a19486d796ba7ce
|
||||
@@ -1,14 +1,14 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: lcm Pages: 1 -->
|
||||
<svg width="109pt" height="28pt"
|
||||
viewBox="0.00 0.00 109.00 28.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 24)">
|
||||
<svg width="109pt" height="46pt"
|
||||
viewBox="0.00 0.00 109.00 46.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 42)">
|
||||
<title>lcm</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-24 105,-24 105,4 -4,4"/>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-42 105,-42 105,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
@@ -33,5 +33,11 @@
|
||||
<path fill="none" stroke="midnightblue" d="M32.09,-10C39.61,-10 48.92,-10 57.54,-10"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="57.54,-13.5 67.54,-10 57.54,-6.5 57.54,-13.5"/>
|
||||
</g>
|
||||
<!-- Node2->Node2 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node2->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M74.02,-19.76C68.92,-28.57 72.41,-38 84.5,-38 91.86,-38 96.04,-34.5 97.02,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="100.41,-28.86 94.98,-19.76 93.55,-30.25 100.41,-28.86"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -1 +1 @@
|
||||
9ec980d7843ac0a86185d3408f5fe43b
|
||||
bd2e4573af9ef7e8aea0f15493c1bad6
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="279pt" height="66pt"
|
||||
@@ -78,5 +78,11 @@
|
||||
<path fill="none" stroke="midnightblue" d="M191.31,-10C201.75,-10 215.83,-10 227.95,-10"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="227.96,-13.5 237.96,-10 227.95,-6.5 227.96,-13.5"/>
|
||||
</g>
|
||||
<!-- Node5->Node5 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>Node5->Node5</title>
|
||||
<path fill="none" stroke="midnightblue" d="M242.48,-19.76C236.63,-28.57 240.64,-38 254.5,-38 262.95,-38 267.74,-34.5 268.86,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="272.21,-28.7 266.52,-19.76 265.39,-30.29 272.21,-28.7"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.1 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: math/ncr_modulo_p.cpp Pages: 1 -->
|
||||
<svg width="193pt" height="84pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: numerical_methods/durand_kerner_roots.cpp Pages: 1 -->
|
||||
<!--zoomable 95 -->
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: numerical_methods/durand_kerner_roots.cpp Pages: 1 -->
|
||||
<svg width="602pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: sorting/pigeonhole_sort.cpp Pages: 1 -->
|
||||
<svg width="264pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -1,4 +0,0 @@
|
||||
<map id="Trie::TrieNode" name="Trie::TrieNode">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="24,109,131,136"/>
|
||||
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/memory/shared_ptr.html" title=" " alt="" coords="5,5,149,47"/>
|
||||
</map>
|
||||
@@ -1 +0,0 @@
|
||||
9dda26383752407f35291cf519219b01
|
||||
@@ -1,39 +0,0 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
-->
|
||||
<!-- Title: Trie::TrieNode Pages: 1 -->
|
||||
<svg width="116pt" height="106pt"
|
||||
viewBox="0.00 0.00 116.00 106.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 102)">
|
||||
<title>Trie::TrieNode</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-102 112,-102 112,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title=" ">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="14,-0.5 14,-19.5 94,-19.5 94,-0.5 14,-0.5"/>
|
||||
<text text-anchor="middle" x="54" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">Trie::TrieNode</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/memory/shared_ptr.html" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="0,-67.5 0,-97.5 108,-97.5 108,-67.5 0,-67.5"/>
|
||||
<text text-anchor="start" x="8" y="-85.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::shared_ptr< Trie</text>
|
||||
<text text-anchor="middle" x="54" y="-74.5" font-family="Helvetica,sans-Serif" font-size="10.00">::TrieNode ></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="M54,-57.09C54,-44.21 54,-29.2 54,-19.89"/>
|
||||
<polygon fill="#9a32cd" stroke="#9a32cd" points="50.5,-57.23 54,-67.23 57.5,-57.23 50.5,-57.23"/>
|
||||
<text text-anchor="middle" x="76.5" y="-41" font-family="Helvetica,sans-Serif" font-size="10.00"> character</text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: range_queries/sparse_table.cpp Pages: 1 -->
|
||||
<svg width="269pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/fibonacci_fast.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d32/fibonacci__fast_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,8 +93,7 @@ $(document).ready(function(){initNavTree('d4/d32/fibonacci__fast_8cpp.html','../
|
||||
<div class="summary">
|
||||
<a href="#define-members">Macros</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">fibonacci_fast.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">fibonacci_fast.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
@@ -110,12 +109,12 @@ Include dependency graph for fibonacci_fast.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
|
||||
Macros</h2></td></tr>
|
||||
<tr class="memitem:a392fb874e547e582e9c66a08a1f23326"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/fibonacci__fast_8cpp.html#a392fb874e547e582e9c66a08a1f23326">MAX</a>   93</td></tr>
|
||||
<tr class="separator:a392fb874e547e582e9c66a08a1f23326"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a5712edca101204eca8accdb1e096707f"><td class="memItemLeft" align="right" valign="top">uint64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/fibonacci__fast_8cpp.html#a5712edca101204eca8accdb1e096707f">fib</a> (uint64_t n)</td></tr>
|
||||
<tr class="separator:a5712edca101204eca8accdb1e096707f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -123,12 +122,12 @@ 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>Faster computation of Fibonacci series. </p>
|
||||
<p>An efficient way to calculate nth fibonacci number faster and simpler than \(O(n\log n)\) method of matrix exponentiation This works by using both recursion and dynamic programming. as 93rd fibonacci exceeds 19 digits, which cannot be stored in a single long long variable, we can only use it till 92nd fibonacci we can use it for 10000th fibonacci etc, if we implement bigintegers. This algorithm works with the fact that nth fibonacci can easily found if we have already found n/2th or (n+1)/2th fibonacci It is a property of fibonacci similar to matrix exponentiation.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
|
||||
<div class="textblock"><p >Faster computation of Fibonacci series. </p>
|
||||
<p >An efficient way to calculate nth fibonacci number faster and simpler than \(O(n\log n)\) method of matrix exponentiation This works by using both recursion and dynamic programming. as 93rd fibonacci exceeds 19 digits, which cannot be stored in a single long long variable, we can only use it till 92nd fibonacci we can use it for 10000th fibonacci etc, if we implement bigintegers. This algorithm works with the fact that nth fibonacci can easily found if we have already found n/2th or (n+1)/2th fibonacci It is a property of fibonacci similar to matrix exponentiation.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala" target="_blank">Krishna Vedala</a> </dd></dl>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../de/de4/fibonacci__large_8cpp.html" title="Computes N^th Fibonacci number given as input argument. Uses custom build arbitrary integers library ...">fibonacci_large.cpp</a>, <a class="el" href="../../d9/d89/fibonacci_8cpp.html" title="Generate fibonacci sequence.">fibonacci.cpp</a>, <a class="el" href="../../de/d47/string__fibonacci_8cpp.html" title="This Programme returns the Nth fibonacci as a string.">string_fibonacci.cpp</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Macro Definition Documentation</h2>
|
||||
<a id="a392fb874e547e582e9c66a08a1f23326"></a>
|
||||
<a id="a392fb874e547e582e9c66a08a1f23326" name="a392fb874e547e582e9c66a08a1f23326"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a392fb874e547e582e9c66a08a1f23326">◆ </a></span>MAX</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -139,12 +138,12 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>maximum number that can be computed - The result after 93 cannot be stored in a <code>uint64_t</code> data type. </p>
|
||||
<p >maximum number that can be computed - The result after 93 cannot be stored in a <code>uint64_t</code> data type. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a5712edca101204eca8accdb1e096707f"></a>
|
||||
<a id="a5712edca101204eca8accdb1e096707f" name="a5712edca101204eca8accdb1e096707f"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a5712edca101204eca8accdb1e096707f">◆ </a></span>fib()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -159,31 +158,31 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Algorithm </p>
|
||||
<div class="fragment"><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  {</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keyword">static</span> uint64_t f1 = 1,</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  f2 = 1; <span class="comment">// using static keyword will retain the values of</span></div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="comment">// f1 and f2 for the next function call.</span></div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> (n <= 2)</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">return</span> f2;</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordflow">if</span> (n >= 93) {</div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a></div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  << <span class="stringliteral">"Cannot compute for n>93 due to limit of 64-bit integers\n"</span>;</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  </div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  uint64_t temp = f2; <span class="comment">// we do not need temp to be static</span></div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  f2 += f1;</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  f1 = temp;</div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  </div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordflow">return</span> f2;</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> }</div>
|
||||
<p >Algorithm </p>
|
||||
<div class="fragment"><div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> {</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">static</span> uint64_t f1 = 1,</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> f2 = 1; <span class="comment">// using static keyword will retain the values of</span></div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="comment">// f1 and f2 for the next function call.</span></div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordflow">if</span> (n <= 2)</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">return</span> f2;</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keywordflow">if</span> (n >= 93) {</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a></div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> << <span class="stringliteral">"Cannot compute for n>93 due to limit of 64-bit integers\n"</span>;</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> }</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> uint64_t temp = f2; <span class="comment">// we do not need temp to be static</span></div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> f2 += f1;</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> f1 = temp;</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">return</span> f2;</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -198,14 +197,14 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  {</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// Main Function</span></div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">for</span> (uint64_t i = 1; i < 93; i++) {</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << i << <span class="stringliteral">" th fibonacci number is "</span> << <a class="code" href="../../d4/d32/fibonacci__fast_8cpp.html#a5712edca101204eca8accdb1e096707f">fib</a>(i) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  }</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> }</div>
|
||||
<p >Main function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> {</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="comment">// Main Function</span></div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">for</span> (uint64_t i = 1; i < 93; i++) {</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << i << <span class="stringliteral">" th fibonacci number is "</span> << <a class="code hl_function" href="../../d4/d32/fibonacci__fast_8cpp.html#a5712edca101204eca8accdb1e096707f">fib</a>(i) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> }</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span>}</div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="afibonacci__fast_8cpp_html_a5712edca101204eca8accdb1e096707f"><div class="ttname"><a href="../../d4/d32/fibonacci__fast_8cpp.html#a5712edca101204eca8accdb1e096707f">fib</a></div><div class="ttdeci">uint64_t fib(uint64_t n)</div><div class="ttdef"><b>Definition:</b> fibonacci_fast.cpp:30</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
@@ -223,7 +222,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="../../d4/d32/fibonacci__fast_8cpp.html">fibonacci_fast.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="136pt" height="66pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: operations_on_datastructures/inorder_successor_of_bst.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d32/inorder__successor__of__bst_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -94,12 +94,11 @@ $(document).ready(function(){initNavTree('d4/d32/inorder__successor__of__bst_8cp
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">inorder_successor_of_bst.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">inorder_successor_of_bst.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal.
|
||||
<p>An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA" target="_blank">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal.
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
<code>#include <iostream></code><br />
|
||||
@@ -111,7 +110,7 @@ Include dependency graph for inorder_successor_of_bst.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
|
||||
Classes</h2></td></tr>
|
||||
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">A <a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html" title="A Node structure representing a single node in BST.">Node</a> structure representing a single node in BST. <a href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html#details">More...</a><br /></td></tr>
|
||||
@@ -120,38 +119,38 @@ Classes</h2></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">class encapsulating the necessary test cases <a href="../../d5/d58/class_test_cases.html#details">More...</a><br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:da/d6d/namespaceoperations__on__datastructures"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d6d/namespaceoperations__on__datastructures.html">operations_on_datastructures</a></td></tr>
|
||||
<tr class="memitem:da/d6d/namespaceoperations__on__datastructures"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../da/d6d/namespaceoperations__on__datastructures.html">operations_on_datastructures</a></td></tr>
|
||||
<tr class="memdesc:da/d6d/namespaceoperations__on__datastructures"><td class="mdescLeft"> </td><td class="mdescRight">for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:dd/d74/namespaceinorder__successor__of__bst"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d74/namespaceinorder__successor__of__bst.html">inorder_successor_of_bst</a></td></tr>
|
||||
<tr class="memdesc:dd/d74/namespaceinorder__successor__of__bst"><td class="mdescLeft"> </td><td class="mdescRight">Functions for the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA">Inorder successor of a binary search tree</a> implementation. <br /></td></tr>
|
||||
<tr class="memitem:dd/d74/namespaceinorder__successor__of__bst"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d74/namespaceinorder__successor__of__bst.html">inorder_successor_of_bst</a></td></tr>
|
||||
<tr class="memdesc:dd/d74/namespaceinorder__successor__of__bst"><td class="mdescLeft"> </td><td class="mdescRight">Functions for the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA" target="_blank">Inorder successor of a binary search tree</a> implementation. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a4852816cc9f28f7b9def0e5beb4e8545"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a4852816cc9f28f7b9def0e5beb4e8545">operations_on_datastructures::inorder_traversal_of_bst::makeNode</a> (int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a4852816cc9f28f7b9def0e5beb4e8545"><td class="mdescLeft"> </td><td class="mdescRight">Allocates a new node in heap for given data and returns it's pointer. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a4852816cc9f28f7b9def0e5beb4e8545">More...</a><br /></td></tr>
|
||||
<tr class="separator:a4852816cc9f28f7b9def0e5beb4e8545"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a2153df6265379da9bda259af3f46556a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a2153df6265379da9bda259af3f46556a">operations_on_datastructures::inorder_traversal_of_bst::Insert</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a2153df6265379da9bda259af3f46556a"><td class="mdescLeft"> </td><td class="mdescRight">Inserts the given data in BST while maintaining the properties of BST. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a2153df6265379da9bda259af3f46556a">More...</a><br /></td></tr>
|
||||
<tr class="separator:a2153df6265379da9bda259af3f46556a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a744afaca22fa7bb91c92209a26f23e8f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">operations_on_datastructures::inorder_traversal_of_bst::getNode</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a744afaca22fa7bb91c92209a26f23e8f"><td class="mdescLeft"> </td><td class="mdescRight">Searches the given data in BST and returns the pointer to the node containing that data. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">More...</a><br /></td></tr>
|
||||
<tr class="separator:a744afaca22fa7bb91c92209a26f23e8f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a25667588088eb647887d1c2bff0efa8c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a25667588088eb647887d1c2bff0efa8c">operations_on_datastructures::inorder_traversal_of_bst::findMinNode</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root)</td></tr>
|
||||
<tr class="memdesc:a25667588088eb647887d1c2bff0efa8c"><td class="mdescLeft"> </td><td class="mdescRight">Finds and return the minimum node in BST. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a25667588088eb647887d1c2bff0efa8c">More...</a><br /></td></tr>
|
||||
<tr class="separator:a25667588088eb647887d1c2bff0efa8c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7f6f73a33beec448c27cc1d70b220702"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7f6f73a33beec448c27cc1d70b220702">operations_on_datastructures::inorder_traversal_of_bst::makeNode</a> (int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a7f6f73a33beec448c27cc1d70b220702"><td class="mdescLeft"> </td><td class="mdescRight">Allocates a new node in heap for given data and returns it's pointer. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7f6f73a33beec448c27cc1d70b220702">More...</a><br /></td></tr>
|
||||
<tr class="separator:a7f6f73a33beec448c27cc1d70b220702"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a3ae0bea4123fd2ce155108e88f2ef78c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a3ae0bea4123fd2ce155108e88f2ef78c">operations_on_datastructures::inorder_traversal_of_bst::Insert</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a3ae0bea4123fd2ce155108e88f2ef78c"><td class="mdescLeft"> </td><td class="mdescRight">Inserts the given data in BST while maintaining the properties of BST. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a3ae0bea4123fd2ce155108e88f2ef78c">More...</a><br /></td></tr>
|
||||
<tr class="separator:a3ae0bea4123fd2ce155108e88f2ef78c"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a824cbf1814854824cf05f062eea07b95"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">operations_on_datastructures::inorder_traversal_of_bst::getNode</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a824cbf1814854824cf05f062eea07b95"><td class="mdescLeft"> </td><td class="mdescRight">Searches the given data in BST and returns the pointer to the node containing that data. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">More...</a><br /></td></tr>
|
||||
<tr class="separator:a824cbf1814854824cf05f062eea07b95"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a72483e3f6933e004a8d86371e8a990db"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a72483e3f6933e004a8d86371e8a990db">operations_on_datastructures::inorder_traversal_of_bst::findMinNode</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root)</td></tr>
|
||||
<tr class="memdesc:a72483e3f6933e004a8d86371e8a990db"><td class="mdescLeft"> </td><td class="mdescRight">Finds and return the minimum node in BST. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a72483e3f6933e004a8d86371e8a990db">More...</a><br /></td></tr>
|
||||
<tr class="separator:a72483e3f6933e004a8d86371e8a990db"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a5d7266b934ca50c4f53e4f1e725d89a4"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">operations_on_datastructures::inorder_traversal_of_bst::printInorder</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root)</td></tr>
|
||||
<tr class="memdesc:a5d7266b934ca50c4f53e4f1e725d89a4"><td class="mdescLeft"> </td><td class="mdescRight">Prints the BST in inorder traversal using recursion. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">More...</a><br /></td></tr>
|
||||
<tr class="separator:a5d7266b934ca50c4f53e4f1e725d89a4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad0ca93be4f9576bfb715a4864a30dbee"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#ad0ca93be4f9576bfb715a4864a30dbee">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > &<a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:ad0ca93be4f9576bfb715a4864a30dbee"><td class="mdescLeft"> </td><td class="mdescRight">This function is used in test cases to quickly create BST containing large data instead of hard coding it in code. For a given root, this will add all the nodes containing data passes in data vector. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#ad0ca93be4f9576bfb715a4864a30dbee">More...</a><br /></td></tr>
|
||||
<tr class="separator:ad0ca93be4f9576bfb715a4864a30dbee"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a9aa3fac9aa48a6568ecf89aaee190d43"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a9aa3fac9aa48a6568ecf89aaee190d43">operations_on_datastructures::inorder_traversal_of_bst::getInorderSuccessor</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a9aa3fac9aa48a6568ecf89aaee190d43"><td class="mdescLeft"> </td><td class="mdescRight">Inorder successor of a node is the next node in inorder traversal of the Binary Tree. This function takes the root node and the data of the node for which we have to find the inorder successor, and returns the inorder successor node. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a9aa3fac9aa48a6568ecf89aaee190d43">More...</a><br /></td></tr>
|
||||
<tr class="separator:a9aa3fac9aa48a6568ecf89aaee190d43"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a05fe8a029e155c43e4efa598d4d089d9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a05fe8a029e155c43e4efa598d4d089d9">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< int64_t > &<a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a05fe8a029e155c43e4efa598d4d089d9"><td class="mdescLeft"> </td><td class="mdescRight">This function is used in test cases to quickly create BST containing large data instead of hard coding it in code. For a given root, this will add all the nodes containing data passes in data vector. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a05fe8a029e155c43e4efa598d4d089d9">More...</a><br /></td></tr>
|
||||
<tr class="separator:a05fe8a029e155c43e4efa598d4d089d9"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a3923fb22b46e085376703cae0b44d690"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a3923fb22b46e085376703cae0b44d690">operations_on_datastructures::inorder_traversal_of_bst::getInorderSuccessor</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *root, int64_t <a class="el" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>)</td></tr>
|
||||
<tr class="memdesc:a3923fb22b46e085376703cae0b44d690"><td class="mdescLeft"> </td><td class="mdescRight">Inorder successor of a node is the next node in inorder traversal of the Binary Tree. This function takes the root node and the data of the node for which we have to find the inorder successor, and returns the inorder successor node. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a3923fb22b46e085376703cae0b44d690">More...</a><br /></td></tr>
|
||||
<tr class="separator:a3923fb22b46e085376703cae0b44d690"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a7b20eb99272665c1777949e26ab59589"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">operations_on_datastructures::inorder_traversal_of_bst::deallocate</a> (<a class="el" href="../../db/d8b/struct_node.html">Node</a> *rootNode)</td></tr>
|
||||
<tr class="memdesc:a7b20eb99272665c1777949e26ab59589"><td class="mdescLeft"> </td><td class="mdescRight">This function clears the memory allocated to entire tree recursively. Its just for clean up the memory and not relevant to the actual topic. <a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">More...</a><br /></td></tr>
|
||||
<tr class="separator:a7b20eb99272665c1777949e26ab59589"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -163,7 +162,7 @@ Functions</h2></td></tr>
|
||||
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal. </p>
|
||||
<div class="textblock"><p >An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA" target="_blank">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal. </p>
|
||||
<h3><a class="anchor" id="autotoc_md77"></a>
|
||||
Case 1: The given node has the right node/subtree</h3>
|
||||
<pre class="fragment"> * In this case, the left-most deepest node in the right subtree will
|
||||
@@ -184,9 +183,9 @@ Method 2: Search from the root node</h4>
|
||||
<li>In case if there is no link from a child node to the parent node, we need to walk down the tree starting from the root node to the given node, by doing so, we are visiting every ancestor of the given node.</li>
|
||||
<li>In order successor would be the deepest node in this path for which given node is in left subtree.</li>
|
||||
</ul>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/foo290">Nitin Sharma</a> </dd></dl>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/foo290" target="_blank">Nitin Sharma</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a7b20eb99272665c1777949e26ab59589"></a>
|
||||
<a id="a7b20eb99272665c1777949e26ab59589" name="a7b20eb99272665c1777949e26ab59589"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a7b20eb99272665c1777949e26ab59589">◆ </a></span>deallocate()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -210,14 +209,14 @@ Method 2: Search from the root node</h4>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  {</div>
|
||||
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordflow">if</span> (rootNode == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  }</div>
|
||||
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(rootNode->left);</div>
|
||||
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(rootNode->right);</div>
|
||||
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keyword">delete</span> (rootNode);</div>
|
||||
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> {</div>
|
||||
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> <span class="keywordflow">if</span> (rootNode == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> }</div>
|
||||
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(rootNode->left);</div>
|
||||
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(rootNode->right);</div>
|
||||
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <span class="keyword">delete</span> (rootNode);</div>
|
||||
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span>}</div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a7b20eb99272665c1777949e26ab59589"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">operations_on_datastructures::inorder_traversal_of_bst::deallocate</a></div><div class="ttdeci">void deallocate(Node *rootNode)</div><div class="ttdoc">This function clears the memory allocated to entire tree recursively. Its just for clean up the memor...</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:210</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -228,14 +227,14 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a25667588088eb647887d1c2bff0efa8c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a25667588088eb647887d1c2bff0efa8c">◆ </a></span>findMinNode()</h2>
|
||||
<a id="a72483e3f6933e004a8d86371e8a990db" name="a72483e3f6933e004a8d86371e8a990db"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a72483e3f6933e004a8d86371e8a990db">◆ </a></span>findMinNode()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::findMinNode </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::findMinNode </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">Node</a> * </td>
|
||||
<td class="paramname"><em>root</em></td><td>)</td>
|
||||
@@ -252,32 +251,32 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Node* Pointer to the found node </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  {</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  }</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordflow">while</span> (root->left != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  root = root->left;</div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  }</div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> {</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> }</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keywordflow">while</span> (root->left != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> root = root->left;</div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> }</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span>}</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="../../d4/d32/inorder__successor__of__bst_8cpp_a25667588088eb647887d1c2bff0efa8c_cgraph.svg" width="210" height="91"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d32/inorder__successor__of__bst_8cpp_a72483e3f6933e004a8d86371e8a990db_cgraph.svg" width="210" height="91"><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="a9aa3fac9aa48a6568ecf89aaee190d43"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a9aa3fac9aa48a6568ecf89aaee190d43">◆ </a></span>getInorderSuccessor()</h2>
|
||||
<a id="a3923fb22b46e085376703cae0b44d690" name="a3923fb22b46e085376703cae0b44d690"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a3923fb22b46e085376703cae0b44d690">◆ </a></span>getInorderSuccessor()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::getInorderSuccessor </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::getInorderSuccessor </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">Node</a> * </td>
|
||||
<td class="paramname"><em>root</em>, </td>
|
||||
@@ -297,7 +296,7 @@ Here is the call graph for this function:</div>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Inorder successor of a node is the next node in inorder traversal of the Binary Tree. This function takes the root node and the data of the node for which we have to find the inorder successor, and returns the inorder successor node. </p>
|
||||
<p>Search from the root node as we need to walk the tree starting from the root node to the given node, by doing so, we are visiting every ancestor of the given node. In order successor would be the deepest node in this path for which given node is in left subtree. Time complexity O(h) </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >Search from the root node as we need to walk the tree starting from the root node to the given node, by doing so, we are visiting every ancestor of the given node. In order successor would be the deepest node in this path for which given node is in left subtree. Time complexity O(h) </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">root</td><td>A pointer to the root node of the BST </td></tr>
|
||||
<tr><td class="paramname">data</td><td>The data (or the data of node) for which we have to find inorder successor. </td></tr>
|
||||
@@ -305,54 +304,54 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="../../db/d8b/struct_node.html">Node</a> pointer to the inorder successor node. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  {</div>
|
||||
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <a class="code" href="../../db/d8b/struct_node.html">Node</a> *current = <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">getNode</a>(root, <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keywordflow">if</span> (current == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  }</div>
|
||||
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  </div>
|
||||
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="comment">// Case - 1</span></div>
|
||||
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordflow">if</span> (current->right != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="keywordflow">return</span> <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a25667588088eb647887d1c2bff0efa8c">findMinNode</a>(current->right);</div>
|
||||
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  }</div>
|
||||
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <span class="comment">// case - 2</span></div>
|
||||
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <a class="code" href="../../db/d8b/struct_node.html">Node</a> *successor = <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <a class="code" href="../../db/d8b/struct_node.html">Node</a> *ancestor = root;</div>
|
||||
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  </div>
|
||||
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keywordflow">while</span> (ancestor != current && ancestor != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="comment">// This means my current node is in left of the root node</span></div>
|
||||
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordflow">if</span> (current->data < ancestor->data) {</div>
|
||||
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  successor = ancestor;</div>
|
||||
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  ancestor = ancestor->left; <span class="comment">// keep going left</span></div>
|
||||
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  ancestor = ancestor->right;</div>
|
||||
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  }</div>
|
||||
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  }</div>
|
||||
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">return</span> successor; <span class="comment">// Nodes with maximum vales will not have a successor</span></div>
|
||||
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  }</div>
|
||||
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> {</div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a> *current = <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">getNode</a>(root, <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <span class="keywordflow">if</span> (current == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> }</div>
|
||||
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> </div>
|
||||
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// Case - 1</span></div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordflow">if</span> (current->right != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a72483e3f6933e004a8d86371e8a990db">findMinNode</a>(current->right);</div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> }</div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="comment">// case - 2</span></div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a> *successor = <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a> *ancestor = root;</div>
|
||||
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> </div>
|
||||
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <span class="keywordflow">while</span> (ancestor != current && ancestor != <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="comment">// This means my current node is in left of the root node</span></div>
|
||||
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordflow">if</span> (current->data < ancestor->data) {</div>
|
||||
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> successor = ancestor;</div>
|
||||
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> ancestor = ancestor->left; <span class="comment">// keep going left</span></div>
|
||||
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> ancestor = ancestor->right;</div>
|
||||
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> }</div>
|
||||
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> }</div>
|
||||
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="keywordflow">return</span> successor; <span class="comment">// Nodes with maximum vales will not have a successor</span></div>
|
||||
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> }</div>
|
||||
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span>}</div>
|
||||
<div class="ttc" id="ahash__search_8cpp_html_a6e1a77282bc65ad359d753d25df23243"><div class="ttname"><a href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a></div><div class="ttdeci">int data[MAX]</div><div class="ttdoc">test data</div><div class="ttdef"><b>Definition:</b> hash_search.cpp:24</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a25667588088eb647887d1c2bff0efa8c"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a25667588088eb647887d1c2bff0efa8c">operations_on_datastructures::inorder_traversal_of_bst::findMinNode</a></div><div class="ttdeci">Node * findMinNode(Node *root)</div><div class="ttdoc">Finds and return the minimum node in BST.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:121</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a744afaca22fa7bb91c92209a26f23e8f"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">operations_on_datastructures::inorder_traversal_of_bst::getNode</a></div><div class="ttdeci">Node * getNode(Node *root, int64_t data)</div><div class="ttdoc">Searches the given data in BST and returns the pointer to the node containing that data.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:100</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a72483e3f6933e004a8d86371e8a990db"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a72483e3f6933e004a8d86371e8a990db">operations_on_datastructures::inorder_traversal_of_bst::findMinNode</a></div><div class="ttdeci">Node * findMinNode(Node *root)</div><div class="ttdoc">Finds and return the minimum node in BST.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:121</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a824cbf1814854824cf05f062eea07b95"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">operations_on_datastructures::inorder_traversal_of_bst::getNode</a></div><div class="ttdeci">Node * getNode(Node *root, int64_t data)</div><div class="ttdoc">Searches the given data in BST and returns the pointer to the node containing that data.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:100</div></div>
|
||||
<div class="ttc" id="astruct_node_html"><div class="ttname"><a href="../../db/d8b/struct_node.html">Node</a></div><div class="ttdef"><b>Definition:</b> linkedlist_implentation_usingarray.cpp:14</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="../../d4/d32/inorder__successor__of__bst_8cpp_a9aa3fac9aa48a6568ecf89aaee190d43_cgraph.svg" width="210" height="91"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d32/inorder__successor__of__bst_8cpp_a3923fb22b46e085376703cae0b44d690_cgraph.svg" width="210" height="91"><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="a744afaca22fa7bb91c92209a26f23e8f"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a744afaca22fa7bb91c92209a26f23e8f">◆ </a></span>getNode()</h2>
|
||||
<a id="a824cbf1814854824cf05f062eea07b95" name="a824cbf1814854824cf05f062eea07b95"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a824cbf1814854824cf05f062eea07b95">◆ </a></span>getNode()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::getNode </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::getNode </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">Node</a> * </td>
|
||||
<td class="paramname"><em>root</em>, </td>
|
||||
@@ -380,42 +379,41 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Node* pointer to the found node </dd></dl>
|
||||
<p><a class="el" href="../../db/d8b/struct_node.html">Node</a> found!</p>
|
||||
<p>Traverse right subtree recursively as the given data is greater than the data in root node, data must be present in right subtree.</p>
|
||||
<p>Traverse left subtree recursively as the given data is less than the data in root node, data must be present in left subtree.</p>
|
||||
<div class="fragment"><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  {</div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (root-><a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/data.html">data</a> == <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">return</span> root; <span class="comment">/// Node found!</span></div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> > root-><a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/data.html">data</a>) {<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment"> /// Traverse right subtree recursively as the given data is greater than</span></div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment"> /// the data in root node, data must be present in right subtree.</span></div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment"></span> <span class="keywordflow">return</span> <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">getNode</a>(root->right, <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  } <span class="keywordflow">else</span> {<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment"> /// Traverse left subtree recursively as the given data is less than the</span></div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="comment"> /// data in root node, data must be present in left subtree.</span></div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="comment"></span> <span class="keywordflow">return</span> <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f">getNode</a>(root->left, <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  }</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> }</div>
|
||||
<div class="ttc" id="adata_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/data.html">std::vector::data</a></div><div class="ttdeci">T data(T... args)</div></div>
|
||||
<p ><a class="el" href="../../db/d8b/struct_node.html">Node</a> found!</p>
|
||||
<p >Traverse right subtree recursively as the given data is greater than the data in root node, data must be present in right subtree.</p>
|
||||
<p >Traverse left subtree recursively as the given data is less than the data in root node, data must be present in left subtree.</p>
|
||||
<div class="fragment"><div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> {</div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (root->data == <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">return</span> root; <span class="comment">/// Node found!</span></div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> > root->data) {<span class="comment"></span></div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span><span class="comment"> /// Traverse right subtree recursively as the given data is greater than</span></div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span><span class="comment"> /// the data in root node, data must be present in right subtree.</span></div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span><span class="comment"></span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">getNode</a>(root->right, <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> } <span class="keywordflow">else</span> {<span class="comment"></span></div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span><span class="comment"> /// Traverse left subtree recursively as the given data is less than the</span></div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span><span class="comment"> /// data in root node, data must be present in left subtree.</span></div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span><span class="comment"></span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95">getNode</a>(root->left, <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> }</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span>}</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="../../d4/d32/inorder__successor__of__bst_8cpp_a744afaca22fa7bb91c92209a26f23e8f_cgraph.svg" width="210" height="91"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d32/inorder__successor__of__bst_8cpp_a824cbf1814854824cf05f062eea07b95_cgraph.svg" width="210" height="91"><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="a2153df6265379da9bda259af3f46556a"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a2153df6265379da9bda259af3f46556a">◆ </a></span>Insert()</h2>
|
||||
<a id="a3ae0bea4123fd2ce155108e88f2ef78c" name="a3ae0bea4123fd2ce155108e88f2ef78c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a3ae0bea4123fd2ce155108e88f2ef78c">◆ </a></span>Insert()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::Insert </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::Insert </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">Node</a> * </td>
|
||||
<td class="paramname"><em>root</em>, </td>
|
||||
@@ -443,21 +441,21 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Node* Pointer to the root node. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  {</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  root = <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a4852816cc9f28f7b9def0e5beb4e8545">makeNode</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (data <= root-><a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  root->left = Insert(root->left, <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  root->right = Insert(root->right, <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> }</div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a4852816cc9f28f7b9def0e5beb4e8545"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a4852816cc9f28f7b9def0e5beb4e8545">operations_on_datastructures::inorder_traversal_of_bst::makeNode</a></div><div class="ttdeci">Node * makeNode(int64_t data)</div><div class="ttdoc">Allocates a new node in heap for given data and returns it's pointer.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:68</div></div>
|
||||
<div class="fragment"><div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> {</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> root = <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7f6f73a33beec448c27cc1d70b220702">makeNode</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (data <= root-><a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> root->left = Insert(root->left, <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> root->right = Insert(root->right, <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>);</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> }</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span>}</div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a7f6f73a33beec448c27cc1d70b220702"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7f6f73a33beec448c27cc1d70b220702">operations_on_datastructures::inorder_traversal_of_bst::makeNode</a></div><div class="ttdeci">Node * makeNode(int64_t data)</div><div class="ttdoc">Allocates a new node in heap for given data and returns it's pointer.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:68</div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97" name="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -492,51 +490,51 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
<p>< root node of the bst</p>
|
||||
<p>< Data to add nodes in BST</p>
|
||||
<p>< An element to find inorder successor for.</p>
|
||||
<p>< Making BST</p>
|
||||
<p>memory cleanup!</p>
|
||||
<div class="fragment"><div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  {</div>
|
||||
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  </div>
|
||||
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <a class="code" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a> *root =</div>
|
||||
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  <span class="keyword">nullptr</span>; <span class="comment">///< root node of the bst</span></div>
|
||||
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int64_t></a> node_data{3, 4, 5,</div>
|
||||
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  89, 1, 2}; <span class="comment">///< Data to add nodes in BST</span></div>
|
||||
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  </div>
|
||||
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  int64_t targetElement = 4; <span class="comment">///< An element to find inorder successor for.</span></div>
|
||||
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  root = <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#ad0ca93be4f9576bfb715a4864a30dbee">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a>(</div>
|
||||
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  root, node_data); <span class="comment">///< Making BST</span></div>
|
||||
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  </div>
|
||||
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <a class="code" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a></div>
|
||||
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  *inorderSuccessor = operations_on_datastructures::</div>
|
||||
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  inorder_traversal_of_bst::getInorderSuccessor(root, targetElement);</div>
|
||||
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  </div>
|
||||
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"In-order sequence is : "</span>;</div>
|
||||
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">operations_on_datastructures::inorder_traversal_of_bst::printInorder</a>(root);</div>
|
||||
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  </div>
|
||||
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <span class="keywordflow">if</span> (inorderSuccessor == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Inorder successor for last node is NULL"</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Target element is : "</span> << targetElement << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Inorder successor for target element is : "</span></div>
|
||||
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  << inorderSuccessor-><a class="code" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html#ae161f3e5ef33ade73429cab9291612e2">data</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  }</div>
|
||||
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>  </div>
|
||||
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(root); <span class="comment">/// memory cleanup!</span></div>
|
||||
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  </div>
|
||||
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span> }</div>
|
||||
<p >< root node of the bst</p>
|
||||
<p >< Data to add nodes in BST</p>
|
||||
<p >< An element to find inorder successor for.</p>
|
||||
<p >< Making BST</p>
|
||||
<p >memory cleanup!</p>
|
||||
<div class="fragment"><div class="line"><a id="l00398" name="l00398"></a><span class="lineno"> 398</span> {</div>
|
||||
<div class="line"><a id="l00399" name="l00399"></a><span class="lineno"> 399</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno"> 400</span> </div>
|
||||
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno"> 401</span> <a class="code hl_class" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a> *root =</div>
|
||||
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno"> 402</span> <span class="keyword">nullptr</span>; <span class="comment">///< root node of the bst</span></div>
|
||||
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno"> 403</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int64_t></a> node_data{3, 4, 5,</div>
|
||||
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno"> 404</span> 89, 1, 2}; <span class="comment">///< Data to add nodes in BST</span></div>
|
||||
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno"> 405</span> </div>
|
||||
<div class="line"><a id="l00406" name="l00406"></a><span class="lineno"> 406</span> int64_t targetElement = 4; <span class="comment">///< An element to find inorder successor for.</span></div>
|
||||
<div class="line"><a id="l00407" name="l00407"></a><span class="lineno"> 407</span> root = <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a05fe8a029e155c43e4efa598d4d089d9">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a>(</div>
|
||||
<div class="line"><a id="l00408" name="l00408"></a><span class="lineno"> 408</span> root, node_data); <span class="comment">///< Making BST</span></div>
|
||||
<div class="line"><a id="l00409" name="l00409"></a><span class="lineno"> 409</span> </div>
|
||||
<div class="line"><a id="l00410" name="l00410"></a><span class="lineno"> 410</span> <a class="code hl_class" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a></div>
|
||||
<div class="line"><a id="l00411" name="l00411"></a><span class="lineno"> 411</span> *inorderSuccessor = operations_on_datastructures::</div>
|
||||
<div class="line"><a id="l00412" name="l00412"></a><span class="lineno"> 412</span> inorder_traversal_of_bst::getInorderSuccessor(root, targetElement);</div>
|
||||
<div class="line"><a id="l00413" name="l00413"></a><span class="lineno"> 413</span> </div>
|
||||
<div class="line"><a id="l00414" name="l00414"></a><span class="lineno"> 414</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">"In-order sequence is : "</span>;</div>
|
||||
<div class="line"><a id="l00415" name="l00415"></a><span class="lineno"> 415</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">operations_on_datastructures::inorder_traversal_of_bst::printInorder</a>(root);</div>
|
||||
<div class="line"><a id="l00416" name="l00416"></a><span class="lineno"> 416</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00417" name="l00417"></a><span class="lineno"> 417</span> </div>
|
||||
<div class="line"><a id="l00418" name="l00418"></a><span class="lineno"> 418</span> <span class="keywordflow">if</span> (inorderSuccessor == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00419" name="l00419"></a><span class="lineno"> 419</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">"Inorder successor for last node is NULL"</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00420" name="l00420"></a><span class="lineno"> 420</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><a id="l00421" name="l00421"></a><span class="lineno"> 421</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">"Target element is : "</span> << targetElement << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00422" name="l00422"></a><span class="lineno"> 422</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">"Inorder successor for target element is : "</span></div>
|
||||
<div class="line"><a id="l00423" name="l00423"></a><span class="lineno"> 423</span> << inorderSuccessor-><a class="code hl_variable" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html#ae161f3e5ef33ade73429cab9291612e2">data</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00424" name="l00424"></a><span class="lineno"> 424</span> }</div>
|
||||
<div class="line"><a id="l00425" name="l00425"></a><span class="lineno"> 425</span> </div>
|
||||
<div class="line"><a id="l00426" name="l00426"></a><span class="lineno"> 426</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589">deallocate</a>(root); <span class="comment">/// memory cleanup!</span></div>
|
||||
<div class="line"><a id="l00427" name="l00427"></a><span class="lineno"> 427</span> </div>
|
||||
<div class="line"><a id="l00428" name="l00428"></a><span class="lineno"> 428</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00429" name="l00429"></a><span class="lineno"> 429</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aclassoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node_html"><div class="ttname"><a href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">operations_on_datastructures::inorder_traversal_of_bst::Node</a></div><div class="ttdoc">A Node structure representing a single node in BST.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:56</div></div>
|
||||
<div class="ttc" id="aclassoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node_html_ae161f3e5ef33ade73429cab9291612e2"><div class="ttname"><a href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html#ae161f3e5ef33ade73429cab9291612e2">operations_on_datastructures::inorder_traversal_of_bst::Node::data</a></div><div class="ttdeci">int64_t data</div><div class="ttdoc">The key/value of the node.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:58</div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a05fe8a029e155c43e4efa598d4d089d9"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a05fe8a029e155c43e4efa598d4d089d9">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a></div><div class="ttdeci">Node * makeBST(Node *root, const std::vector< int64_t > &data)</div><div class="ttdoc">This function is used in test cases to quickly create BST containing large data instead of hard codin...</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:155</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_a5d7266b934ca50c4f53e4f1e725d89a4"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">operations_on_datastructures::inorder_traversal_of_bst::printInorder</a></div><div class="ttdeci">void printInorder(Node *root)</div><div class="ttdoc">Prints the BST in inorder traversal using recursion.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:136</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:387</div></div>
|
||||
<div class="ttc" id="ainorder__successor__of__bst_8cpp_html_ad0ca93be4f9576bfb715a4864a30dbee"><div class="ttname"><a href="../../d4/d32/inorder__successor__of__bst_8cpp.html#ad0ca93be4f9576bfb715a4864a30dbee">operations_on_datastructures::inorder_traversal_of_bst::makeBST</a></div><div class="ttdeci">Node * makeBST(Node *root, const std::vector< int64_t > &data)</div><div class="ttdoc">This function is used in test cases to quickly create BST containing large data instead of hard codin...</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:155</div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector< int64_t ></a></div></div>
|
||||
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -546,14 +544,14 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ad0ca93be4f9576bfb715a4864a30dbee"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ad0ca93be4f9576bfb715a4864a30dbee">◆ </a></span>makeBST()</h2>
|
||||
<a id="a05fe8a029e155c43e4efa598d4d089d9" name="a05fe8a029e155c43e4efa598d4d089d9"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a05fe8a029e155c43e4efa598d4d089d9">◆ </a></span>makeBST()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::makeBST </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::makeBST </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="../../d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html">Node</a> * </td>
|
||||
<td class="paramname"><em>root</em>, </td>
|
||||
@@ -581,29 +579,29 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="../../db/d8b/struct_node.html">Node</a> pointer to the root node. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  {</div>
|
||||
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">for</span> (int64_t values : <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  root = Insert(root, values);</div>
|
||||
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  }</div>
|
||||
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> {</div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="keywordflow">for</span> (int64_t values : <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>) {</div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> root = Insert(root, values);</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> }</div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordflow">return</span> root;</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span>}</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="../../d4/d32/inorder__successor__of__bst_8cpp_ad0ca93be4f9576bfb715a4864a30dbee_cgraph.svg" width="210" height="91"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d32/inorder__successor__of__bst_8cpp_a05fe8a029e155c43e4efa598d4d089d9_cgraph.svg" width="210" height="91"><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="a4852816cc9f28f7b9def0e5beb4e8545"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a4852816cc9f28f7b9def0e5beb4e8545">◆ </a></span>makeNode()</h2>
|
||||
<a id="a7f6f73a33beec448c27cc1d70b220702" name="a7f6f73a33beec448c27cc1d70b220702"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a7f6f73a33beec448c27cc1d70b220702">◆ </a></span>makeNode()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a>* operations_on_datastructures::inorder_traversal_of_bst::makeNode </td>
|
||||
<td class="memname"><a class="el" href="../../db/d8b/struct_node.html">Node</a> * operations_on_datastructures::inorder_traversal_of_bst::makeNode </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">int64_t </td>
|
||||
<td class="paramname"><em>data</em></td><td>)</td>
|
||||
@@ -620,28 +618,28 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>A pointer to the newly allocated <a class="el" href="../../db/d8b/struct_node.html">Node</a>. </dd></dl>
|
||||
<p>< setting data for node</p>
|
||||
<p>< setting left child as null</p>
|
||||
<p>< setting right child as null</p>
|
||||
<div class="fragment"><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  {</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <a class="code" href="../../db/d8b/struct_node.html">Node</a> *<a class="code" href="../../d5/da1/structnode.html">node</a> = <span class="keyword">new</span> <a class="code" href="../../db/d8b/struct_node.html">Node</a>();</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="code" href="../../d5/da1/structnode.html">node</a>->data = <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>; <span class="comment">///< setting data for node</span></div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <a class="code" href="../../d5/da1/structnode.html">node</a>->left = <span class="keyword">nullptr</span>; <span class="comment">///< setting left child as null</span></div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <a class="code" href="../../d5/da1/structnode.html">node</a>->right = <span class="keyword">nullptr</span>; <span class="comment">///< setting right child as null</span></div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">return</span> <a class="code" href="../../d1/df3/hash__search_8cpp.html#a8ca8dcb494104d273679e219e53d0555">node</a>;</div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> }</div>
|
||||
<p >< setting data for node</p>
|
||||
<p >< setting left child as null</p>
|
||||
<p >< setting right child as null</p>
|
||||
<div class="fragment"><div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> {</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a> *<a class="code hl_class" href="../../d5/da1/structnode.html">node</a> = <span class="keyword">new</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a>();</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>->data = <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>; <span class="comment">///< setting data for node</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>->left = <span class="keyword">nullptr</span>; <span class="comment">///< setting left child as null</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>->right = <span class="keyword">nullptr</span>; <span class="comment">///< setting right child as null</span></div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="../../d1/df3/hash__search_8cpp.html#a8ca8dcb494104d273679e219e53d0555">node</a>;</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span>}</div>
|
||||
<div class="ttc" id="ahash__search_8cpp_html_a8ca8dcb494104d273679e219e53d0555"><div class="ttname"><a href="../../d1/df3/hash__search_8cpp.html#a8ca8dcb494104d273679e219e53d0555">node</a></div><div class="ttdeci">struct list node</div></div>
|
||||
<div class="ttc" id="astructnode_html"><div class="ttname"><a href="../../d5/da1/structnode.html">node</a></div><div class="ttdef"><b>Definition:</b> avltree.cpp:13</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="../../d4/d32/inorder__successor__of__bst_8cpp_a4852816cc9f28f7b9def0e5beb4e8545_cgraph.svg" width="210" height="91"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d32/inorder__successor__of__bst_8cpp_a7f6f73a33beec448c27cc1d70b220702_cgraph.svg" width="210" height="91"><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="a5d7266b934ca50c4f53e4f1e725d89a4"></a>
|
||||
<a id="a5d7266b934ca50c4f53e4f1e725d89a4" name="a5d7266b934ca50c4f53e4f1e725d89a4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a5d7266b934ca50c4f53e4f1e725d89a4">◆ </a></span>printInorder()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -665,17 +663,17 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<p>recursive call to left subtree</p>
|
||||
<p>recursive call to right subtree</p>
|
||||
<div class="fragment"><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  {</div>
|
||||
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  }</div>
|
||||
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  </div>
|
||||
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">printInorder</a>(root->left); <span class="comment">/// recursive call to left subtree</span></div>
|
||||
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << root-><a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/data.html">data</a> << <span class="stringliteral">" "</span>;</div>
|
||||
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <a class="code" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">printInorder</a>(root->right); <span class="comment">/// recursive call to right subtree</span></div>
|
||||
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span> }</div>
|
||||
<p >recursive call to left subtree</p>
|
||||
<p >recursive call to right subtree</p>
|
||||
<div class="fragment"><div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> {</div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keywordflow">if</span> (root == <span class="keyword">nullptr</span>) {</div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> }</div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">printInorder</a>(root->left); <span class="comment">/// recursive call to left subtree</span></div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << root->data << <span class="stringliteral">" "</span>;</div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <a class="code hl_function" href="../../d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4">printInorder</a>(root->right); <span class="comment">/// recursive call to right subtree</span></div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -685,7 +683,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">◆ </a></span>test()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -710,10 +708,10 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Self-test implementations. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  {</div>
|
||||
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <a class="code" href="../../d5/d58/class_test_cases.html">TestCases</a> tc;</div>
|
||||
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  tc.<a class="code" href="../../d5/d58/class_test_cases.html#aeabea90c02f9159e4a784bbf736e1e23">runTests</a>();</div>
|
||||
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00387" name="l00387"></a><span class="lineno"> 387</span> {</div>
|
||||
<div class="line"><a id="l00388" name="l00388"></a><span class="lineno"> 388</span> <a class="code hl_class" href="../../d5/d58/class_test_cases.html">TestCases</a> tc;</div>
|
||||
<div class="line"><a id="l00389" name="l00389"></a><span class="lineno"> 389</span> tc.<a class="code hl_function" href="../../d5/d58/class_test_cases.html#aeabea90c02f9159e4a784bbf736e1e23">runTests</a>();</div>
|
||||
<div class="line"><a id="l00390" name="l00390"></a><span class="lineno"> 390</span>}</div>
|
||||
<div class="ttc" id="aclass_test_cases_html"><div class="ttname"><a href="../../d5/d58/class_test_cases.html">TestCases</a></div><div class="ttdoc">class encapsulating the necessary test cases</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:225</div></div>
|
||||
<div class="ttc" id="aclass_test_cases_html_aeabea90c02f9159e4a784bbf736e1e23"><div class="ttname"><a href="../../d5/d58/class_test_cases.html#aeabea90c02f9159e4a784bbf736e1e23">TestCases::runTests</a></div><div class="ttdeci">void runTests()</div><div class="ttdoc">Executes test cases.</div><div class="ttdef"><b>Definition:</b> inorder_successor_of_bst.cpp:243</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
@@ -731,7 +729,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_35422be6552f1b3672c1b6c4aba2da64.html">operations_on_datastructures</a></li><li class="navelem"><a class="el" href="../../d4/d32/inorder__successor__of__bst_8cpp.html">inorder_successor_of_bst.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
14
d4/d32/inorder__successor__of__bst_8cpp.js
vendored
@@ -1,15 +1,15 @@
|
||||
var inorder__successor__of__bst_8cpp =
|
||||
[
|
||||
[ "Node", "d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html", "d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node" ],
|
||||
[ "operations_on_datastructures::inorder_traversal_of_bst::Node", "d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node.html", "d5/db5/classoperations__on__datastructures_1_1inorder__traversal__of__bst_1_1_node" ],
|
||||
[ "TestCases", "d5/d58/class_test_cases.html", "d5/d58/class_test_cases" ],
|
||||
[ "deallocate", "d4/d32/inorder__successor__of__bst_8cpp.html#a7b20eb99272665c1777949e26ab59589", null ],
|
||||
[ "findMinNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a25667588088eb647887d1c2bff0efa8c", null ],
|
||||
[ "getInorderSuccessor", "d4/d32/inorder__successor__of__bst_8cpp.html#a9aa3fac9aa48a6568ecf89aaee190d43", null ],
|
||||
[ "getNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a744afaca22fa7bb91c92209a26f23e8f", null ],
|
||||
[ "Insert", "d4/d32/inorder__successor__of__bst_8cpp.html#a2153df6265379da9bda259af3f46556a", null ],
|
||||
[ "findMinNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a72483e3f6933e004a8d86371e8a990db", null ],
|
||||
[ "getInorderSuccessor", "d4/d32/inorder__successor__of__bst_8cpp.html#a3923fb22b46e085376703cae0b44d690", null ],
|
||||
[ "getNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a824cbf1814854824cf05f062eea07b95", null ],
|
||||
[ "Insert", "d4/d32/inorder__successor__of__bst_8cpp.html#a3ae0bea4123fd2ce155108e88f2ef78c", null ],
|
||||
[ "main", "d4/d32/inorder__successor__of__bst_8cpp.html#a0ddf1224851353fc92bfbff6f499fa97", null ],
|
||||
[ "makeBST", "d4/d32/inorder__successor__of__bst_8cpp.html#ad0ca93be4f9576bfb715a4864a30dbee", null ],
|
||||
[ "makeNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a4852816cc9f28f7b9def0e5beb4e8545", null ],
|
||||
[ "makeBST", "d4/d32/inorder__successor__of__bst_8cpp.html#a05fe8a029e155c43e4efa598d4d089d9", null ],
|
||||
[ "makeNode", "d4/d32/inorder__successor__of__bst_8cpp.html#a7f6f73a33beec448c27cc1d70b220702", null ],
|
||||
[ "printInorder", "d4/d32/inorder__successor__of__bst_8cpp.html#a5d7266b934ca50c4f53e4f1e725d89a4", null ],
|
||||
[ "test", "d4/d32/inorder__successor__of__bst_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ]
|
||||
];
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::makeBST Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<!--zoomable 142 -->
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="621pt" height="142pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::getInorderSuccessor Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::printInorder Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::findMinNode Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::deallocate Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::makeNode Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: operations_on_datastructures::inorder_traversal_of_bst::getNode Pages: 1 -->
|
||||
<svg width="157pt" height="68pt"
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test Pages: 1 -->
|
||||
<!--zoomable 142 -->
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test Pages: 1 -->
|
||||
<svg width="547pt" height="142pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/power_of_two.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d38/power__of__two_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,8 +93,7 @@ $(document).ready(function(){initNavTree('d4/d38/power__of__two_8cpp.html','../.
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">power_of_two.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">power_of_two.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
@@ -108,13 +107,13 @@ Include dependency graph for power_of_two.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:dd/d47/namespacemath"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html">math</a></td></tr>
|
||||
<tr class="memitem:dd/d47/namespacemath"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html">math</a></td></tr>
|
||||
<tr class="memdesc:dd/d47/namespacemath"><td class="mdescLeft"> </td><td class="mdescRight">for IO operations <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a89ab7d6c3e3ee72a8cbaa85127986185"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#a89ab7d6c3e3ee72a8cbaa85127986185">math::power_of_two</a> (int n)</td></tr>
|
||||
<tr class="memdesc:a89ab7d6c3e3ee72a8cbaa85127986185"><td class="mdescLeft"> </td><td class="mdescRight">Function to test above algorithm. <a href="../../dd/d47/namespacemath.html#a89ab7d6c3e3ee72a8cbaa85127986185">More...</a><br /></td></tr>
|
||||
@@ -124,15 +123,15 @@ 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>Implementation to check whether a number is a power of 2 or not. </p>
|
||||
<p>This algorithm uses bit manipulation to check if a number is a power of 2 or not.</p>
|
||||
<div class="textblock"><p >Implementation to check whether a number is a power of 2 or not. </p>
|
||||
<p >This algorithm uses bit manipulation to check if a number is a power of 2 or not.</p>
|
||||
<h3><a class="anchor" id="autotoc_md75"></a>
|
||||
Algorithm</h3>
|
||||
<p>Let the input number be n, then the bitwise and between n and n-1 will let us know whether the number is power of 2 or not</p>
|
||||
<p>For Example, If N= 32 then N-1 is 31, if we perform bitwise and of these two numbers then the result will be zero, which indicates that it is the power of 2 If N=23 then N-1 is 22, if we perform bitwise and of these two numbers then the result will not be zero , which indicates that it is not the power of 2 </p><dl class="section note"><dt>Note</dt><dd>This implementation is better than naive recursive or iterative approach.</dd></dl>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/neha-hasija17">Neha Hasija</a> </dd></dl>
|
||||
<p >Let the input number be n, then the bitwise and between n and n-1 will let us know whether the number is power of 2 or not</p>
|
||||
<p >For Example, If N= 32 then N-1 is 31, if we perform bitwise and of these two numbers then the result will be zero, which indicates that it is the power of 2 If N=23 then N-1 is 22, if we perform bitwise and of these two numbers then the result will not be zero , which indicates that it is not the power of 2 </p><dl class="section note"><dt>Note</dt><dd>This implementation is better than naive recursive or iterative approach.</dd></dl>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/neha-hasija17" target="_blank">Neha Hasija</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -150,22 +149,22 @@ Algorithm</h3>
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
<p>n stores the input from the user</p>
|
||||
<p>function call with</p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >n stores the input from the user</p>
|
||||
<p >function call with</p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">n</td><td></td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  {</div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordtype">int</span> n = 0;<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment"> /// n stores the input from the user</span></div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> <span class="comment"></span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"enter a number "</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> n;<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <span class="comment"> /// function call with @param n</span></div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="comment"></span> <a class="code" href="../../dd/d47/namespacemath.html#a89ab7d6c3e3ee72a8cbaa85127986185">math::power_of_two</a>(n);</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> {</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">int</span> n = 0;<span class="comment"></span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="comment"> /// n stores the input from the user</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span><span class="comment"></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">"enter a number "</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> n;<span class="comment"></span></div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span><span class="comment"> /// function call with @param n</span></div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="comment"></span> <a class="code hl_function" href="../../dd/d47/namespacemath.html#a89ab7d6c3e3ee72a8cbaa85127986185">math::power_of_two</a>(n);</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span>}</div>
|
||||
<div class="ttc" id="abasic_istream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a></div></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
@@ -185,7 +184,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="../../d4/d38/power__of__two_8cpp.html">power_of_two.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="189pt" height="66pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: Open Addressing</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d39/group__open__addressing.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,16 +90,31 @@ $(document).ready(function(){initNavTree('d4/d39/group__open__addressing.html','
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Open Addressing</div> </div>
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> </div>
|
||||
<div class="headertitle"><div class="title">Open Addressing</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:d0/d65/namespacedouble__hashing"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d65/namespacedouble__hashing.html">double_hashing</a></td></tr>
|
||||
<tr class="memdesc:d0/d65/namespacedouble__hashing"><td class="mdescLeft"> </td><td class="mdescRight">An implementation of hash table using <a href="https://en.wikipedia.org/wiki/Double_hashing" target="_blank">double hashing</a> algorithm. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:d8/d89/namespacelinear__probing"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d89/namespacelinear__probing.html">linear_probing</a></td></tr>
|
||||
<tr class="memdesc:d8/d89/namespacelinear__probing"><td class="mdescLeft"> </td><td class="mdescRight">An implementation of hash table using <a href="https://en.wikipedia.org/wiki/Linear_probing" target="_blank">linear probing</a> algorithm. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:d4/dd2/namespacequadratic__probing"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/dd2/namespacequadratic__probing.html">quadratic_probing</a></td></tr>
|
||||
<tr class="memdesc:d4/dd2/namespacequadratic__probing"><td class="mdescLeft"> </td><td class="mdescRight">An implementation of hash table using <a href="https://en.wikipedia.org/wiki/Quadratic_probing" target="_blank">quadratic probing</a> algorithm. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
6
d4/d39/group__open__addressing.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var group__open__addressing =
|
||||
[
|
||||
[ "double_hashing", "d0/d65/namespacedouble__hashing.html", null ],
|
||||
[ "linear_probing", "d8/d89/namespacelinear__probing.html", null ],
|
||||
[ "quadratic_probing", "d4/dd2/namespacequadratic__probing.html", null ]
|
||||
];
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: backtracking/n_queens.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d3e/n__queens_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d4/d3e/n__queens_8cpp.html','../../');
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">n_queens.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">n_queens.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle">Eight Queens</a> puzzle
|
||||
<p><a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle" target="_blank">Eight Queens</a> puzzle
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <iostream></code><br />
|
||||
<code>#include <array></code><br />
|
||||
@@ -109,16 +108,16 @@ Include dependency graph for n_queens.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:db/dc0/namespacebacktracking"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/dc0/namespacebacktracking.html">backtracking</a></td></tr>
|
||||
<tr class="memitem:db/dc0/namespacebacktracking"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/dc0/namespacebacktracking.html">backtracking</a></td></tr>
|
||||
<tr class="memdesc:db/dc0/namespacebacktracking"><td class="mdescLeft"> </td><td class="mdescRight">Backtracking algorithms. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:d3/da1/namespacen__queens"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/da1/namespacen__queens.html">n_queens</a></td></tr>
|
||||
<tr class="memdesc:d3/da1/namespacen__queens"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle">Eight Queens</a> puzzle. <br /></td></tr>
|
||||
<tr class="memitem:d3/da1/namespacen__queens"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/da1/namespacen__queens.html">n_queens</a></td></tr>
|
||||
<tr class="memdesc:d3/da1/namespacen__queens"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle" target="_blank">Eight Queens</a> puzzle. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a40ae0c7fd04eb20e7f3bff13fc6a5808"><td class="memTemplParams" colspan="2">template<size_t n> </td></tr>
|
||||
<tr class="memitem:a40ae0c7fd04eb20e7f3bff13fc6a5808"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d4/d3e/n__queens_8cpp.html#a40ae0c7fd04eb20e7f3bff13fc6a5808">backtracking::n_queens::printSolution</a> (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>< int, n >, n > &board)</td></tr>
|
||||
@@ -133,13 +132,13 @@ 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><a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle">Eight Queens</a> puzzle </p>
|
||||
<p>The <b>eight queens puzzle</b> is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general <b>n queens problem</b> of placing n non-attacking queens on an n×n chessboard, for which solutions exist for all natural numbers n with the exception of n = 2 and n = 3.</p>
|
||||
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Eight_queens_puzzle" target="_blank">Eight Queens</a> puzzle </p>
|
||||
<p >The <b>eight queens puzzle</b> is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal. The eight queens puzzle is an example of the more general <b>n queens problem</b> of placing n non-attacking queens on an n×n chessboard, for which solutions exist for all natural numbers n with the exception of n = 2 and n = 3.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd>Unknown author </dd>
|
||||
<dd>
|
||||
<a href="https://github.com/Panquesito7">David Leal</a> </dd></dl>
|
||||
<a href="https://github.com/Panquesito7" target="_blank">David Leal</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a5730b6683f6adcf5c5ef75cf53dc7160"></a>
|
||||
<a id="a5730b6683f6adcf5c5ef75cf53dc7160" name="a5730b6683f6adcf5c5ef75cf53dc7160"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a5730b6683f6adcf5c5ef75cf53dc7160">◆ </a></span>isSafe()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -172,7 +171,7 @@ template<size_t n> </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Check if a queen can be placed on matrix </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<p >Check if a queen can be placed on matrix </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<table class="tparams">
|
||||
<tr><td class="paramname">n</td><td>number of matrix size </td></tr>
|
||||
</table>
|
||||
@@ -189,34 +188,34 @@ template<size_t n> </div>
|
||||
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if queen can be placed on matrix </dd>
|
||||
<dd>
|
||||
<code>false</code> if queen can't be placed on matrix </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  {</div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordtype">int</span> i = 0, j = 0;</div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  </div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">// Check this row on left side</span></div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">for</span> (i = 0; i < col; i++) {</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">if</span> (board[row][i]) {</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  }</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  }</div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  </div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="comment">// Check upper diagonal on left side</span></div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">for</span> (i = row, j = col; i >= 0 && j >= 0; i--, j--) {</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span> (board[i][j]) {</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  }</div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">// Check lower diagonal on left side</span></div>
|
||||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">for</span> (i = row, j = col; j >= 0 && i < n; i++, j--) {</div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">if</span> (board[i][j]) {</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  }</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> {</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">int</span> i = 0, j = 0;</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// Check this row on left side</span></div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">for</span> (i = 0; i < col; i++) {</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">if</span> (board[row][i]) {</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> }</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> }</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="comment">// Check upper diagonal on left side</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordflow">for</span> (i = row, j = col; i >= 0 && j >= 0; i--, j--) {</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">if</span> (board[i][j]) {</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> }</div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="comment">// Check lower diagonal on left side</span></div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordflow">for</span> (i = row, j = col; j >= 0 && i < n; i++, j--) {</div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">if</span> (board[i][j]) {</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> }</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -231,24 +230,24 @@ template<size_t n> </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  {</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> n = 4;</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<std::array<int, n></a>, n> board = {</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0})</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  };</div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  </div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  backtracking::n_queens::solveNQ<n>(board, 0);</div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> }</div>
|
||||
<p >Main function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> {</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keyword">const</span> <span class="keywordtype">int</span> n = 4;</div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<std::array<int, n></a>, n> board = {</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0}),</div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int, n></a>({0, 0, 0, 0})</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> };</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> backtracking::n_queens::solveNQ<n>(board, 0);</div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span>}</div>
|
||||
<div class="ttc" id="aarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a40ae0c7fd04eb20e7f3bff13fc6a5808"></a>
|
||||
<a id="a40ae0c7fd04eb20e7f3bff13fc6a5808" name="a40ae0c7fd04eb20e7f3bff13fc6a5808"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a40ae0c7fd04eb20e7f3bff13fc6a5808">◆ </a></span>printSolution()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -265,7 +264,7 @@ template<size_t n> </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Utility function to print matrix </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<p >Utility function to print matrix </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<table class="tparams">
|
||||
<tr><td class="paramname">n</td><td>number of matrix size </td></tr>
|
||||
</table>
|
||||
@@ -277,20 +276,20 @@ template<size_t n> </div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  {</div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < n; j++) {</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">""</span> << board[i][j] << <span class="stringliteral">" "</span>;</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  }</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  }</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> {</div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</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">"\n"</span>;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < n; j++) {</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</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">""</span> << board[i][j] << <span class="stringliteral">" "</span>;</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> }</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</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">"\n"</span>;</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> }</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> }</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a0dbd7af47d87f0b956609fe9e3288ecb"></a>
|
||||
<a id="a0dbd7af47d87f0b956609fe9e3288ecb" name="a0dbd7af47d87f0b956609fe9e3288ecb"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0dbd7af47d87f0b956609fe9e3288ecb">◆ </a></span>solveNQ()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -317,7 +316,7 @@ template<size_t n> </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Solve n queens problem </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<p >Solve n queens problem </p><dl class="tparams"><dt>Template Parameters</dt><dd>
|
||||
<table class="tparams">
|
||||
<tr><td class="paramname">n</td><td>number of matrix size </td></tr>
|
||||
</table>
|
||||
@@ -330,28 +329,28 @@ template<size_t n> </div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  {</div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (col >= n) {</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  printSolution<n>(board);</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  }</div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  </div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="comment">// Consider this column and try placing</span></div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="comment">// this queen in all rows one by one</span></div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="comment">// Check if queen can be placed</span></div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="comment">// on board[i][col]</span></div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (isSafe<n>(board, i, col)) {</div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="comment">// Place this queen in matrix</span></div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  board[i][col] = 1;</div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  </div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="comment">// Recursive to place rest of the queens</span></div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  solveNQ<n>(board, col + 1);</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  </div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  board[i][col] = 0; <span class="comment">// backtrack</span></div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  }</div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  }</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> {</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keywordflow">if</span> (col >= n) {</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> printSolution<n>(board);</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordflow">return</span>;</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> }</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// Consider this column and try placing</span></div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// this queen in all rows one by one</span></div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// Check if queen can be placed</span></div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="comment">// on board[i][col]</span></div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">if</span> (isSafe<n>(board, i, col)) {</div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// Place this queen in matrix</span></div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> board[i][col] = 1;</div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="comment">// Recursive to place rest of the queens</span></div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> solveNQ<n>(board, col + 1);</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> board[i][col] = 0; <span class="comment">// backtrack</span></div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> }</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -367,7 +366,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_c11585dfcef32a26e29098facab6c144.html">backtracking</a></li><li class="navelem"><a class="el" href="../../d4/d3e/n__queens_8cpp.html">n_queens.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: backtracking::n_queens::solveNQ Pages: 1 -->
|
||||
<svg width="130pt" height="57pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/gcd_recursive_euclidean.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d45/gcd__recursive__euclidean_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -92,12 +92,11 @@ $(document).ready(function(){initNavTree('d4/d45/gcd__recursive__euclidean_8cpp.
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">gcd_recursive_euclidean.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">gcd_recursive_euclidean.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Compute the greatest common denominator of two integers using <em>recursive form</em> of <a href="https://en.wikipedia.org/wiki/Euclidean_algorithm">Euclidean algorithm</a>
|
||||
<p>Compute the greatest common denominator of two integers using <em>recursive form</em> of <a href="https://en.wikipedia.org/wiki/Euclidean_algorithm" target="_blank">Euclidean algorithm</a>
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <iostream></code><br />
|
||||
</div><div class="textblock"><div class="dynheader">
|
||||
@@ -107,7 +106,7 @@ Include dependency graph for gcd_recursive_euclidean.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:ae48807fa2b7000afae599e67f327545e"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a> (int num1, int num2)</td></tr>
|
||||
<tr class="separator:ae48807fa2b7000afae599e67f327545e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -115,10 +114,10 @@ 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 the greatest common denominator of two integers using <em>recursive form</em> of <a href="https://en.wikipedia.org/wiki/Euclidean_algorithm">Euclidean algorithm</a> </p>
|
||||
<div class="textblock"><p >Compute the greatest common denominator of two integers using <em>recursive form</em> of <a href="https://en.wikipedia.org/wiki/Euclidean_algorithm" target="_blank">Euclidean algorithm</a> </p>
|
||||
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d4/da0/gcd__iterative__euclidean_8cpp.html" title="Compute the greatest common denominator of two integers using iterative form of Euclidean algorithm">gcd_iterative_euclidean.cpp</a>, <a class="el" href="../../d1/d11/gcd__of__n__numbers_8cpp.html" title="This program aims at calculating the GCD of n numbers by division method.">gcd_of_n_numbers.cpp</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae48807fa2b7000afae599e67f327545e"></a>
|
||||
<a id="ae48807fa2b7000afae599e67f327545e" name="ae48807fa2b7000afae599e67f327545e"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae48807fa2b7000afae599e67f327545e">◆ </a></span>gcd()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -143,37 +142,43 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>algorithm </p>
|
||||
<div class="fragment"><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  {</div>
|
||||
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  <span class="keywordflow">if</span> (num1 <= 0 | num2 <= 0) {</div>
|
||||
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keywordflow">throw</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/domain_error.html">std::domain_error</a>(<span class="stringliteral">"Euclidean algorithm domain is for ints > 0"</span>);</div>
|
||||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  }</div>
|
||||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  </div>
|
||||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keywordflow">if</span> (num1 == num2) {</div>
|
||||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  }</div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  </div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="comment">// Everything divides 0</span></div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keywordflow">if</span> (num1 == 0)</div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">return</span> num2;</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordflow">if</span> (num2 == 0)</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  </div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="comment">// base case</span></div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordflow">if</span> (num1 == num2)</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  </div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="comment">// a is greater</span></div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">if</span> (num1 > num2)</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">return</span> <a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(num1 - num2, num2);</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">return</span> <a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(num1, num2 - num1);</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> }</div>
|
||||
<p >algorithm </p>
|
||||
<div class="fragment"><div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> {</div>
|
||||
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="keywordflow">if</span> (num1 <= 0 | num2 <= 0) {</div>
|
||||
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="keywordflow">throw</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/domain_error.html">std::domain_error</a>(<span class="stringliteral">"Euclidean algorithm domain is for ints > 0"</span>);</div>
|
||||
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> }</div>
|
||||
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
|
||||
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordflow">if</span> (num1 == num2) {</div>
|
||||
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> }</div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> </div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="comment">// Everything divides 0</span></div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">if</span> (num1 == 0)</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">return</span> num2;</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keywordflow">if</span> (num2 == 0)</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="comment">// base case</span></div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">if</span> (num1 == num2)</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordflow">return</span> num1;</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="comment">// a is greater</span></div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="keywordflow">if</span> (num1 > num2)</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(num1 - num2, num2);</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(num1, num2 - num1);</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>}</div>
|
||||
<div class="ttc" id="adomain_error_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/domain_error.html">std::domain_error</a></div></div>
|
||||
<div class="ttc" id="agcd__recursive__euclidean_8cpp_html_ae48807fa2b7000afae599e67f327545e"><div class="ttname"><a href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a></div><div class="ttdeci">int gcd(int num1, int num2)</div><div class="ttdef"><b>Definition:</b> gcd_recursive_euclidean.cpp:14</div></div>
|
||||
</div><!-- fragment -->
|
||||
</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="../../d4/d45/gcd__recursive__euclidean_8cpp_ae48807fa2b7000afae599e67f327545e_cgraph.svg" width="55" height="62"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -188,24 +193,24 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  {</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"gcd of 120,7 is "</span> << (<a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(120, 7)) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">try</span> {</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"gcd of -120,10 is "</span> << <a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(-120, 10) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/domain_error.html">std::domain_error</a> &e) {</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Error handling was successful"</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  }</div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"gcd of 312,221 is "</span> << (<a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(312, 221)) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"gcd of 289,204 is "</span> << (<a class="code" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(289, 204)) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div>
|
||||
<p >Main function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> {</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</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">"gcd of 120,7 is "</span> << (<a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(120, 7)) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">try</span> {</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</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">"gcd of -120,10 is "</span> << <a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(-120, 10) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> } <span class="keywordflow">catch</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/domain_error.html">std::domain_error</a> &e) {</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</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">"Error handling was successful"</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> }</div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</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">"gcd of 312,221 is "</span> << (<a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(312, 221)) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</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">"gcd of 289,204 is "</span> << (<a class="code hl_function" href="../../d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e">gcd</a>(289, 204)) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(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="../../d4/d45/gcd__recursive__euclidean_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="182" height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d45/gcd__recursive__euclidean_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="182" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -217,7 +222,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="../../d4/d45/gcd__recursive__euclidean_8cpp.html">gcd_recursive_euclidean.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<map id="gcd" name="gcd">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,29,49,56"/>
|
||||
</map>
|
||||
@@ -0,0 +1 @@
|
||||
63194f545c045f973d0472cef162735b
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: gcd Pages: 1 -->
|
||||
<svg width="41pt" height="46pt"
|
||||
viewBox="0.00 0.00 41.00 46.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 42)">
|
||||
<title>gcd</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-42 37,-42 37,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title=" ">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-0.5 0,-19.5 33,-19.5 33,-0.5 0,-0.5"/>
|
||||
<text text-anchor="middle" x="16.5" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">gcd</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node1</title>
|
||||
<path fill="none" stroke="midnightblue" d="M11.57,-19.76C9.17,-28.57 10.81,-38 16.5,-38 19.97,-38 21.93,-34.5 22.39,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="25.87,-29.38 21.43,-19.76 18.9,-30.05 25.87,-29.38"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,5 +1,5 @@
|
||||
<map id="main" name="main">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,31,56,57"/>
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,43,56,69"/>
|
||||
<area shape="rect" id="node2" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/io/manip/endl.html#" title=" " alt="" coords="104,5,176,32"/>
|
||||
<area shape="rect" id="node3" href="$d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e" title=" " alt="" coords="118,56,162,83"/>
|
||||
<area shape="rect" id="node3" href="$d4/d45/gcd__recursive__euclidean_8cpp.html#ae48807fa2b7000afae599e67f327545e" title=" " alt="" coords="118,80,162,107"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0a510339d6503e41ca87c42775bfae21
|
||||
c72e9bdf4852af158ecad75d464e2730
|
||||
@@ -1,20 +1,20 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="136pt" height="66pt"
|
||||
viewBox="0.00 0.00 136.00 66.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 62)">
|
||||
<svg width="136pt" height="84pt"
|
||||
viewBox="0.00 0.00 136.00 84.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 80)">
|
||||
<title>main</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-62 132,-62 132,4 -4,4"/>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-80 132,-80 132,4 -4,4"/>
|
||||
<!-- Node1 -->
|
||||
<g id="node1" class="node">
|
||||
<title>Node1</title>
|
||||
<g id="a_node1"><a xlink:title=" ">
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-19.5 0,-38.5 38,-38.5 38,-19.5 0,-19.5"/>
|
||||
<text text-anchor="middle" x="19" y="-26.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
<polygon fill="#bfbfbf" stroke="black" points="0,-28.5 0,-47.5 38,-47.5 38,-28.5 0,-28.5"/>
|
||||
<text text-anchor="middle" x="19" y="-35.5" font-family="Helvetica,sans-Serif" font-size="10.00">main</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
@@ -22,16 +22,16 @@
|
||||
<g id="node2" class="node">
|
||||
<title>Node2</title>
|
||||
<g id="a_node2"><a target="_blank" xlink:href="http://en.cppreference.com/w/cpp/io/manip/endl.html#" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="74,-38.5 74,-57.5 128,-57.5 128,-38.5 74,-38.5"/>
|
||||
<text text-anchor="middle" x="101" y="-45.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::endl</text>
|
||||
<polygon fill="white" stroke="black" points="74,-56.5 74,-75.5 128,-75.5 128,-56.5 74,-56.5"/>
|
||||
<text text-anchor="middle" x="101" y="-63.5" font-family="Helvetica,sans-Serif" font-size="10.00">std::endl</text>
|
||||
</a>
|
||||
</g>
|
||||
</g>
|
||||
<!-- Node1->Node2 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>Node1->Node2</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-33.31C45.79,-35.13 54.96,-37.3 63.87,-39.42"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="63.19,-42.85 73.73,-41.76 64.8,-36.04 63.19,-42.85"/>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-44.35C45.87,-47.06 55.16,-50.3 64.16,-53.46"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="63.13,-56.8 73.73,-56.8 65.44,-50.2 63.13,-56.8"/>
|
||||
</g>
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
@@ -45,8 +45,14 @@
|
||||
<!-- Node1->Node3 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>Node1->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-24.69C48.92,-22.13 62.74,-18.85 74.58,-16.04"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="75.43,-19.43 84.35,-13.72 73.81,-12.62 75.43,-19.43"/>
|
||||
<path fill="none" stroke="midnightblue" d="M38.15,-31.65C48.92,-27.88 62.74,-23.04 74.58,-18.9"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="76.07,-22.09 84.35,-15.48 73.75,-15.48 76.07,-22.09"/>
|
||||
</g>
|
||||
<!-- Node3->Node3 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>Node3->Node3</title>
|
||||
<path fill="none" stroke="midnightblue" d="M88.36,-19.76C82.21,-28.57 86.43,-38 101,-38 109.88,-38 114.91,-34.5 116.1,-29.77"/>
|
||||
<polygon fill="midnightblue" stroke="midnightblue" points="119.43,-28.63 113.64,-19.76 112.63,-30.3 119.43,-28.63"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: bit_manipulation/hamming_distance.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d48/hamming__distance_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d4/d48/hamming__distance_8cpp.html','.
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">hamming_distance.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">hamming_distance.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Returns the <a href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a> between two integers.
|
||||
<p>Returns the <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between two integers.
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
<code>#include <iostream></code><br />
|
||||
@@ -109,16 +108,16 @@ Include dependency graph for hamming_distance.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:d7/d81/namespacebit__manipulation"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d81/namespacebit__manipulation.html">bit_manipulation</a></td></tr>
|
||||
<tr class="memitem:d7/d81/namespacebit__manipulation"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d81/namespacebit__manipulation.html">bit_manipulation</a></td></tr>
|
||||
<tr class="memdesc:d7/d81/namespacebit__manipulation"><td class="mdescLeft"> </td><td class="mdescRight">for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a> <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:d4/d1c/namespacehamming__distance"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d1c/namespacehamming__distance.html">hamming_distance</a></td></tr>
|
||||
<tr class="memdesc:d4/d1c/namespacehamming__distance"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a> implementation. <br /></td></tr>
|
||||
<tr class="memitem:d4/d1c/namespacehamming__distance"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d1c/namespacehamming__distance.html">hamming_distance</a></td></tr>
|
||||
<tr class="memdesc:d4/d1c/namespacehamming__distance"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> implementation. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a65d845df3fecff7087a2126c7b72030b"><td class="memItemLeft" align="right" valign="top">uint64_t </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d48/hamming__distance_8cpp.html#a65d845df3fecff7087a2126c7b72030b">bit_manipulation::hamming_distance::bitCount</a> (uint64_t value)</td></tr>
|
||||
<tr class="separator:a65d845df3fecff7087a2126c7b72030b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -134,11 +133,11 @@ 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>Returns the <a href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a> between two integers. </p>
|
||||
<p>To find hamming distance between two integers, we take their xor, which will have a set bit iff those bits differ in the two numbers. Hence, we return the number of such set bits.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/ravibitsgoa">Ravishankar Joshi</a> </dd></dl>
|
||||
<div class="textblock"><p >Returns the <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between two integers. </p>
|
||||
<p >To find hamming distance between two integers, we take their xor, which will have a set bit iff those bits differ in the two numbers. Hence, we return the number of such set bits.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/ravibitsgoa" target="_blank">Ravishankar Joshi</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a65d845df3fecff7087a2126c7b72030b"></a>
|
||||
<a id="a65d845df3fecff7087a2126c7b72030b" name="a65d845df3fecff7087a2126c7b72030b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a65d845df3fecff7087a2126c7b72030b">◆ </a></span>bitCount()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -153,23 +152,23 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>This function returns the number of set bits in the given number. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >This function returns the number of set bits in the given number. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">value</td><td>the number of which we want to count the number of set bits. </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>the number of set bits in the given number. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  {</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  uint64_t count = 0;</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">while</span> (value) { <span class="comment">// until all bits are zero</span></div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordflow">if</span> (value & 1) { <span class="comment">// check lower bit</span></div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  count++;</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  }</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  value >>= 1; <span class="comment">// shift bits, removing lower bit</span></div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  }</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">return</span> count;</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> {</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> uint64_t count = 0;</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">while</span> (value) { <span class="comment">// until all bits are zero</span></div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keywordflow">if</span> (value & 1) { <span class="comment">// check lower bit</span></div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> count++;</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> }</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> value >>= 1; <span class="comment">// shift bits, removing lower bit</span></div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> }</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordflow">return</span> count;</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -179,7 +178,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a40ba9fe8b5df5c268f0c7d677ff2fe80"></a>
|
||||
<a id="a40ba9fe8b5df5c268f0c7d677ff2fe80" name="a40ba9fe8b5df5c268f0c7d677ff2fe80"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a40ba9fe8b5df5c268f0c7d677ff2fe80">◆ </a></span>hamming_distance() <span class="overload">[1/2]</span></h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -204,7 +203,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>This function returns the hamming distance between two strings. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >This function returns the hamming distance between two strings. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">a</td><td>the first string </td></tr>
|
||||
<tr><td class="paramname">b</td><td>the second string </td></tr>
|
||||
@@ -212,15 +211,15 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>the number of characters differing between the two strings. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  {</div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  assert(a.size() == b.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">size</a>());</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordtype">size_t</span> n = a.size();</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  uint64_t count = 0;</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  count += (b[i] != a[i]);</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  }</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordflow">return</span> count;</div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> {</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> assert(a.size() == b.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">size</a>());</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordtype">size_t</span> n = a.size();</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> uint64_t count = 0;</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < n; i++) {</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> count += (b[i] != a[i]);</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> }</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordflow">return</span> count;</div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span>}</div>
|
||||
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/size.html">std::string::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>
|
||||
@@ -231,7 +230,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="abfe6fbb2f3460a2623c96f283178a07a"></a>
|
||||
<a id="abfe6fbb2f3460a2623c96f283178a07a" name="abfe6fbb2f3460a2623c96f283178a07a"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#abfe6fbb2f3460a2623c96f283178a07a">◆ </a></span>hamming_distance() <span class="overload">[2/2]</span></h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -256,7 +255,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>This function returns the hamming distance between two integers. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >This function returns the hamming distance between two integers. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">a</td><td>the first number </td></tr>
|
||||
<tr><td class="paramname">b</td><td>the second number </td></tr>
|
||||
@@ -264,7 +263,7 @@ Here is the call graph for this function:</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>the number of bits differing between the two integers. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> { <span class="keywordflow">return</span> <a class="code" href="../../d4/d48/hamming__distance_8cpp.html#a65d845df3fecff7087a2126c7b72030b">bitCount</a>(a ^ b); }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span>{ <span class="keywordflow">return</span> <a class="code hl_function" href="../../d4/d48/hamming__distance_8cpp.html#a65d845df3fecff7087a2126c7b72030b">bitCount</a>(a ^ b); }</div>
|
||||
<div class="ttc" id="ahamming__distance_8cpp_html_a65d845df3fecff7087a2126c7b72030b"><div class="ttname"><a href="../../d4/d48/hamming__distance_8cpp.html#a65d845df3fecff7087a2126c7b72030b">bit_manipulation::hamming_distance::bitCount</a></div><div class="ttdeci">uint64_t bitCount(uint64_t value)</div><div class="ttdef"><b>Definition:</b> hamming_distance.cpp:34</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -275,7 +274,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -293,15 +292,15 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  {</div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="code" href="../../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// execute the tests</span></div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  uint64_t a = 11; <span class="comment">// 1011 in binary</span></div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  uint64_t b = 2; <span class="comment">// 0010 in binary</span></div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  </div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Hamming distance between "</span> << a << <span class="stringliteral">" and "</span> << b << <span class="stringliteral">" is "</span></div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  << <a class="code" href="../../d4/d48/hamming__distance_8cpp.html#abfe6fbb2f3460a2623c96f283178a07a">bit_manipulation::hamming_distance::hamming_distance</a>(a, b)</div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> {</div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <a class="code hl_function" href="../../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// execute the tests</span></div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> uint64_t a = 11; <span class="comment">// 1011 in binary</span></div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> uint64_t b = 2; <span class="comment">// 0010 in binary</span></div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</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">"Hamming distance between "</span> << a << <span class="stringliteral">" and "</span> << b << <span class="stringliteral">" is "</span></div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> << <a class="code hl_function" href="../../d4/d48/hamming__distance_8cpp.html#abfe6fbb2f3460a2623c96f283178a07a">bit_manipulation::hamming_distance::hamming_distance</a>(a, b)</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="ahamming__distance_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d4/d48/hamming__distance_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Function to the test hamming distance.</div><div class="ttdef"><b>Definition:</b> hamming_distance.cpp:75</div></div>
|
||||
@@ -315,7 +314,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">◆ </a></span>test()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -340,25 +339,25 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Function to the test hamming distance. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  {</div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  assert(bit_manipulation::hamming_distance::hamming_distance(11, 2) == 2);</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  assert(bit_manipulation::hamming_distance::hamming_distance(2, 0) == 1);</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  assert(bit_manipulation::hamming_distance::hamming_distance(11, 0) == 3);</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  </div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"1101"</span>,</div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="stringliteral">"1111"</span>) == 1);</div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"1111"</span>,</div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="stringliteral">"1111"</span>) == 0);</div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"0000"</span>,</div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="stringliteral">"1111"</span>) == 4);</div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  </div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"alpha"</span>,</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="stringliteral">"alphb"</span>) == 1);</div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"abcd"</span>,</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="stringliteral">"abcd"</span>) == 0);</div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"dcba"</span>,</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="stringliteral">"abcd"</span>) == 4);</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> {</div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> assert(bit_manipulation::hamming_distance::hamming_distance(11, 2) == 2);</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> assert(bit_manipulation::hamming_distance::hamming_distance(2, 0) == 1);</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> assert(bit_manipulation::hamming_distance::hamming_distance(11, 0) == 3);</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"1101"</span>,</div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="stringliteral">"1111"</span>) == 1);</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"1111"</span>,</div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="stringliteral">"1111"</span>) == 0);</div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"0000"</span>,</div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="stringliteral">"1111"</span>) == 4);</div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"alpha"</span>,</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="stringliteral">"alphb"</span>) == 1);</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"abcd"</span>,</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="stringliteral">"abcd"</span>) == 0);</div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> assert(bit_manipulation::hamming_distance::hamming_distance(<span class="stringliteral">"dcba"</span>,</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="stringliteral">"abcd"</span>) == 4);</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>}</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -368,7 +367,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_f3c4fbc4e901afa0a54d0623c5574aa7.html">bit_manipulation</a></li><li class="navelem"><a class="el" href="../../d4/d48/hamming__distance_8cpp.html">hamming_distance.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: bit_manipulation::hamming_distance::hamming_distance Pages: 1 -->
|
||||
<svg width="276pt" height="39pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: bit_manipulation::hamming_distance::bitCount Pages: 1 -->
|
||||
<svg width="144pt" height="57pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: bit_manipulation::hamming_distance::hamming_distance Pages: 1 -->
|
||||
<svg width="329pt" height="57pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="136pt" height="66pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: Contributor Covenant Code of Conduct</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d4c/md__c_o_d_e__o_f__c_o_n_d_u_c_t.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -89,17 +89,16 @@ $(document).ready(function(){initNavTree('d4/d4c/md__c_o_d_e__o_f__c_o_n_d_u_c_t
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="PageDoc"><div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Contributor Covenant Code of Conduct </div> </div>
|
||||
<div><div class="header">
|
||||
<div class="headertitle"><div class="title">Contributor Covenant Code of Conduct </div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><h1><a class="anchor" id="autotoc_md4"></a>
|
||||
Our Pledge</h1>
|
||||
<p>In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.</p>
|
||||
<p >In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.</p>
|
||||
<h1><a class="anchor" id="autotoc_md5"></a>
|
||||
Our Standards</h1>
|
||||
<p>Examples of behavior that contributes to creating a positive environment include:</p>
|
||||
<p >Examples of behavior that contributes to creating a positive environment include:</p>
|
||||
<ul>
|
||||
<li>Using welcoming and inclusive language</li>
|
||||
<li>Being respectful of differing viewpoints and experiences</li>
|
||||
@@ -107,7 +106,7 @@ Our Standards</h1>
|
||||
<li>Focusing on what is best for the community</li>
|
||||
<li>Showing empathy towards other community members</li>
|
||||
</ul>
|
||||
<p>Examples of unacceptable behavior by participants include:</p>
|
||||
<p >Examples of unacceptable behavior by participants include:</p>
|
||||
<ul>
|
||||
<li>The use of sexualized language or imagery and unwelcome sexual attention or advances</li>
|
||||
<li>Trolling, insulting/derogatory comments, and personal or political attacks</li>
|
||||
@@ -117,26 +116,26 @@ Our Standards</h1>
|
||||
</ul>
|
||||
<h1><a class="anchor" id="autotoc_md6"></a>
|
||||
Our Responsibilities</h1>
|
||||
<p>Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.</p>
|
||||
<p>Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.</p>
|
||||
<p >Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.</p>
|
||||
<p >Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.</p>
|
||||
<h1><a class="anchor" id="autotoc_md7"></a>
|
||||
Scope</h1>
|
||||
<p>This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.</p>
|
||||
<p >This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.</p>
|
||||
<h1><a class="anchor" id="autotoc_md8"></a>
|
||||
Enforcement</h1>
|
||||
<p>Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <a href="#" onclick="location.href='mai'+'lto:'+'1an'+'up'+'pan'+'wa'+'r@g'+'ma'+'il.'+'co'+'m'; return false;">1anup<span style="display: none;">.nosp@m.</span>panw<span style="display: none;">.nosp@m.</span>ar@gm<span style="display: none;">.nosp@m.</span>ail.<span style="display: none;">.nosp@m.</span>com</a>, <a href="#" onclick="location.href='mai'+'lto:'+'dyn'+'am'+'ite'+'ch'+'eta'+'n@'+'gma'+'il'+'.co'+'m'; return false;">dynam<span style="display: none;">.nosp@m.</span>itec<span style="display: none;">.nosp@m.</span>hetan<span style="display: none;">.nosp@m.</span>@gma<span style="display: none;">.nosp@m.</span>il.co<span style="display: none;">.nosp@m.</span>m</a>, <a href="#" onclick="location.href='mai'+'lto:'+'nik'+'hi'+'lka'+'la'+'8@g'+'ma'+'il.'+'co'+'m'; return false;">nikhi<span style="display: none;">.nosp@m.</span>lkal<span style="display: none;">.nosp@m.</span>a8@gm<span style="display: none;">.nosp@m.</span>ail.<span style="display: none;">.nosp@m.</span>com</a>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.</p>
|
||||
<p>Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.</p>
|
||||
<p >Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <a href="#" onclick="location.href='mai'+'lto:'+'1an'+'up'+'pan'+'wa'+'r@g'+'ma'+'il.'+'co'+'m'; return false;">1anup<span style="display: none;">.nosp@m.</span>panw<span style="display: none;">.nosp@m.</span>ar@gm<span style="display: none;">.nosp@m.</span>ail.<span style="display: none;">.nosp@m.</span>com</a>, <a href="#" onclick="location.href='mai'+'lto:'+'dyn'+'am'+'ite'+'ch'+'eta'+'n@'+'gma'+'il'+'.co'+'m'; return false;">dynam<span style="display: none;">.nosp@m.</span>itec<span style="display: none;">.nosp@m.</span>hetan<span style="display: none;">.nosp@m.</span>@gma<span style="display: none;">.nosp@m.</span>il.co<span style="display: none;">.nosp@m.</span>m</a>, <a href="#" onclick="location.href='mai'+'lto:'+'nik'+'hi'+'lka'+'la'+'8@g'+'ma'+'il.'+'co'+'m'; return false;">nikhi<span style="display: none;">.nosp@m.</span>lkal<span style="display: none;">.nosp@m.</span>a8@gm<span style="display: none;">.nosp@m.</span>ail.<span style="display: none;">.nosp@m.</span>com</a>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.</p>
|
||||
<p >Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.</p>
|
||||
<h1><a class="anchor" id="autotoc_md9"></a>
|
||||
Attribution</h1>
|
||||
<p>This Code of Conduct is adapted from the <a href="https://www.contributor-covenant.org">Contributor Covenant</a>, version 1.4, available at <a href="https://www.contributor-covenant.org/version/1/4/code-of-conduct.html">https://www.contributor-covenant.org/version/1/4/code-of-conduct.html</a></p>
|
||||
<p>For answers to common questions about this code of conduct, see <a href="https://www.contributor-covenant.org/faq">https://www.contributor-covenant.org/faq</a> </p>
|
||||
<p >This Code of Conduct is adapted from the <a href="https://www.contributor-covenant.org" target="_blank">Contributor Covenant</a>, version 1.4, available at <a href="https://www.contributor-covenant.org/version/1/4/code-of-conduct.html">https://www.contributor-covenant.org/version/1/4/code-of-conduct.html</a></p>
|
||||
<p >For answers to common questions about this code of conduct, see <a href="https://www.contributor-covenant.org/faq">https://www.contributor-covenant.org/faq</a> </p>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- PageDoc -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: math/large_factorial.cpp Pages: 1 -->
|
||||
<svg width="489pt" height="140pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/armstrong_number.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d5d/math_2armstrong__number_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -92,12 +92,11 @@ $(document).ready(function(){initNavTree('d4/d5d/math_2armstrong__number_8cpp.ht
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">armstrong_number.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">armstrong_number.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Program to check if a number is an <a href="https://en.wikipedia.org/wiki/Narcissistic_number">Armstrong/Narcissistic number</a> in decimal system.
|
||||
<p>Program to check if a number is an <a href="https://en.wikipedia.org/wiki/Narcissistic_number" target="_blank">Armstrong/Narcissistic number</a> in decimal system.
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
<code>#include <cmath></code><br />
|
||||
@@ -109,7 +108,7 @@ Include dependency graph for armstrong_number.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:aab733299b170fa5a752503f95f090fcd"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd">number_of_digits</a> (int num)</td></tr>
|
||||
<tr class="separator:aab733299b170fa5a752503f95f090fcd"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -121,10 +120,10 @@ 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>Program to check if a number is an <a href="https://en.wikipedia.org/wiki/Narcissistic_number">Armstrong/Narcissistic number</a> in decimal system. </p>
|
||||
<p>Armstrong number or <a href="https://en.wikipedia.org/wiki/Narcissistic_number">Narcissistic number</a> is a number that is the sum of its own digits raised to the power of the number of digits. </p><dl class="section author"><dt>Author</dt><dd>iamnambiar </dd></dl>
|
||||
<div class="textblock"><p >Program to check if a number is an <a href="https://en.wikipedia.org/wiki/Narcissistic_number" target="_blank">Armstrong/Narcissistic number</a> in decimal system. </p>
|
||||
<p >Armstrong number or <a href="https://en.wikipedia.org/wiki/Narcissistic_number" target="_blank">Narcissistic number</a> is a number that is the sum of its own digits raised to the power of the number of digits. </p><dl class="section author"><dt>Author</dt><dd>iamnambiar </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a9cebd92bc70890c3cfa261d68a5016e7"></a>
|
||||
<a id="a9cebd92bc70890c3cfa261d68a5016e7" name="a9cebd92bc70890c3cfa261d68a5016e7"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a9cebd92bc70890c3cfa261d68a5016e7">◆ </a></span>is_armstrong()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -139,7 +138,7 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function to check whether the number is armstrong number or not. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >Function to check whether the number is armstrong number or not. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">num</td><td>Number </td></tr>
|
||||
</table>
|
||||
@@ -148,26 +147,26 @@ Functions</h2></td></tr>
|
||||
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the number is armstrong. </dd>
|
||||
<dd>
|
||||
<code>false</code> if the number is not armstrong. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  {</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="comment">// If the number is less than 0, then it is not a armstrong number.</span></div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">if</span> (number < 0) {</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  }</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordtype">int</span> <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> = 0;</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordtype">int</span> temp = number;</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="comment">// Finding the total number of digits in the number</span></div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordtype">int</span> total_digits = <a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd">number_of_digits</a>(number);</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordflow">while</span> (temp > 0) {</div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordtype">int</span> rem = temp % 10;</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="comment">// Finding each digit raised to the power total digit and add it to the</span></div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="comment">// total sum</span></div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> = <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> + <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(rem, total_digits);</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  temp = temp / 10;</div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  }</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">return</span> number == <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a>;</div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> {</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="comment">// If the number is less than 0, then it is not a armstrong number.</span></div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">if</span> (number < 0) {</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> }</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> = 0;</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordtype">int</span> temp = number;</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="comment">// Finding the total number of digits in the number</span></div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordtype">int</span> total_digits = <a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd">number_of_digits</a>(number);</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordflow">while</span> (temp > 0) {</div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordtype">int</span> rem = temp % 10;</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="comment">// Finding each digit raised to the power total digit and add it to the</span></div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="comment">// total sum</span></div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> = <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(rem, total_digits);</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> temp = temp / 10;</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> }</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">return</span> number == <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a>;</div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>}</div>
|
||||
<div class="ttc" id="amath_2armstrong__number_8cpp_html_aab733299b170fa5a752503f95f090fcd"><div class="ttname"><a href="../../d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd">number_of_digits</a></div><div class="ttdeci">int number_of_digits(int num)</div><div class="ttdef"><b>Definition:</b> armstrong_number.cpp:21</div></div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a5305cc18d11943d3dc0d66e70d7e9c44"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T >> &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a6f1c98c016ad34ff3d9f39372161bd35"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T > > &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
<div class="ttc" id="apow_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a></div><div class="ttdeci">T pow(T... args)</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -178,7 +177,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -193,11 +192,11 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main Function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  {</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> }</div>
|
||||
<p >Main Function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> {</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>}</div>
|
||||
<div class="ttc" id="amath_2armstrong__number_8cpp_html_ae1a3968e7947464bee7714f6d43b7002"><div class="ttname"><a href="../../d4/d5d/math_2armstrong__number_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a></div><div class="ttdeci">void test()</div><div class="ttdef"><b>Definition:</b> armstrong_number.cpp:59</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -208,7 +207,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aab733299b170fa5a752503f95f090fcd"></a>
|
||||
<a id="aab733299b170fa5a752503f95f090fcd" name="aab733299b170fa5a752503f95f090fcd"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aab733299b170fa5a752503f95f090fcd">◆ </a></span>number_of_digits()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -223,25 +222,25 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function to calculate the total number of digits in the number. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >Function to calculate the total number of digits in the number. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">num</td><td>Number </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Total number of digits. </dd></dl>
|
||||
<div class="fragment"><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  {</div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">int</span> total_digits = 0;</div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordflow">while</span> (num > 0) {</div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  num = num / 10;</div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  ++total_digits;</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  }</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordflow">return</span> total_digits;</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> {</div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keywordtype">int</span> total_digits = 0;</div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">while</span> (num > 0) {</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> num = num / 10;</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> ++total_digits;</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> }</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">return</span> total_digits;</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>}</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae1a3968e7947464bee7714f6d43b7002"></a>
|
||||
<a id="ae1a3968e7947464bee7714f6d43b7002" name="ae1a3968e7947464bee7714f6d43b7002"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae1a3968e7947464bee7714f6d43b7002">◆ </a></span>test()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -255,21 +254,21 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for testing the <a class="el" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong()</a> function with all the test cases. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  {</div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="comment">// is_armstrong(370) returns true.</span></div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(370) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="comment">// is_armstrong(225) returns false.</span></div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(225) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">// is_armstrong(-23) returns false.</span></div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(-23) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// is_armstrong(153) returns true.</span></div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(153) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="comment">// is_armstrong(0) returns true.</span></div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(0) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">// is_armstrong(12) returns false.</span></div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  assert(<a class="code" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(12) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> }</div>
|
||||
<p >Function for testing the <a class="el" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong()</a> function with all the test cases. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> {</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="comment">// is_armstrong(370) returns true.</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(370) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// is_armstrong(225) returns false.</span></div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(225) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="comment">// is_armstrong(-23) returns false.</span></div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(-23) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="comment">// is_armstrong(153) returns true.</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(153) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="comment">// is_armstrong(0) returns true.</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(0) == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="comment">// is_armstrong(12) returns false.</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> assert(<a class="code hl_function" href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a>(12) == <span class="keyword">false</span>);</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>}</div>
|
||||
<div class="ttc" id="amath_2armstrong__number_8cpp_html_a9cebd92bc70890c3cfa261d68a5016e7"><div class="ttname"><a href="../../d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7">is_armstrong</a></div><div class="ttdeci">bool is_armstrong(int number)</div><div class="ttdef"><b>Definition:</b> armstrong_number.cpp:36</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -286,7 +285,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="../../d4/d5d/math_2armstrong__number_8cpp.html">armstrong_number.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,56,104,83"/>
|
||||
<area shape="rect" id="node2" href="$d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd" title=" " alt="" coords="170,5,294,32"/>
|
||||
<area shape="rect" id="node3" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/numeric/math/pow.html#" title=" " alt="" coords="196,56,268,83"/>
|
||||
<area shape="rect" id="node4" href="$d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" title=" " alt="" coords="152,107,312,133"/>
|
||||
<area shape="rect" id="node4" href="$d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" title=" " alt="" coords="152,107,312,133"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
cc35a690ba214f72da96bbf83ee7af5e
|
||||
5c7f787ae78bd6e71307a1cff86d665a
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: is_armstrong Pages: 1 -->
|
||||
<svg width="238pt" height="104pt"
|
||||
@@ -51,7 +51,7 @@
|
||||
<!-- Node4 -->
|
||||
<g id="node4" class="node">
|
||||
<title>Node4</title>
|
||||
<g id="a_node4"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" target="_top" xlink:title=" ">
|
||||
<g id="a_node4"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="110,-0.5 110,-19.5 230,-19.5 230,-0.5 110,-0.5"/>
|
||||
<text text-anchor="middle" x="170" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">machine_learning::sum</text>
|
||||
</a>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -3,5 +3,5 @@
|
||||
<area shape="rect" id="node2" href="$d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7" title=" " alt="" coords="97,56,196,83"/>
|
||||
<area shape="rect" id="node3" href="$d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd" title=" " alt="" coords="262,5,386,32"/>
|
||||
<area shape="rect" id="node4" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/numeric/math/pow.html#" title=" " alt="" coords="288,56,360,83"/>
|
||||
<area shape="rect" id="node5" href="$d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" title=" " alt="" coords="244,107,404,133"/>
|
||||
<area shape="rect" id="node5" href="$d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" title=" " alt="" coords="244,107,404,133"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6f4bce45fb6d8c4779ab6d10d366a19b
|
||||
6a8a1e848fc3dd8e2c510392ee4dc8c7
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test Pages: 1 -->
|
||||
<svg width="307pt" height="104pt"
|
||||
@@ -66,7 +66,7 @@
|
||||
<!-- Node5 -->
|
||||
<g id="node5" class="node">
|
||||
<title>Node5</title>
|
||||
<g id="a_node5"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" target="_top" xlink:title=" ">
|
||||
<g id="a_node5"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="179,-0.5 179,-19.5 299,-19.5 299,-0.5 179,-0.5"/>
|
||||
<text text-anchor="middle" x="239" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">machine_learning::sum</text>
|
||||
</a>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -4,5 +4,5 @@
|
||||
<area shape="rect" id="node3" href="$d4/d5d/math_2armstrong__number_8cpp.html#a9cebd92bc70890c3cfa261d68a5016e7" title=" " alt="" coords="196,56,295,83"/>
|
||||
<area shape="rect" id="node4" href="$d4/d5d/math_2armstrong__number_8cpp.html#aab733299b170fa5a752503f95f090fcd" title=" " alt="" coords="361,5,485,32"/>
|
||||
<area shape="rect" id="node5" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/numeric/math/pow.html#" title=" " alt="" coords="387,56,459,83"/>
|
||||
<area shape="rect" id="node6" href="$d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" title=" " alt="" coords="343,107,503,133"/>
|
||||
<area shape="rect" id="node6" href="$d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" title=" " alt="" coords="343,107,503,133"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
52ae47bad3343b518639abb019afad19
|
||||
fa13cc9a2cee0787344a9a84ad711e39
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="381pt" height="104pt"
|
||||
@@ -81,7 +81,7 @@
|
||||
<!-- Node6 -->
|
||||
<g id="node6" class="node">
|
||||
<title>Node6</title>
|
||||
<g id="a_node6"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" target="_top" xlink:title=" ">
|
||||
<g id="a_node6"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="253,-0.5 253,-19.5 373,-19.5 373,-0.5 253,-0.5"/>
|
||||
<text text-anchor="middle" x="313" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">machine_learning::sum</text>
|
||||
</a>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: machine_learning/kohonen_som_trace.cpp Pages: 1 -->
|
||||
<!--zoomable 95 -->
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: machine_learning/kohonen_som_trace.cpp Pages: 1 -->
|
||||
<svg width="582pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: numerical_methods/qr_decompose.h File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h.html','../../'
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">qr_decompose.h File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">qr_decompose.h File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p>Library functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition">QR decomposition</a> of a given matrix.
|
||||
<p>Library functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition" target="_blank">QR decomposition</a> of a given matrix.
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cmath></code><br />
|
||||
<code>#include <cstdlib></code><br />
|
||||
@@ -122,43 +121,43 @@ This graph shows which files directly or indirectly include this file:</div>
|
||||
</div>
|
||||
<p><a href="../../d4/d68/qr__decompose_8h_source.html">Go to the source code of this file.</a></p>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:d2/d3b/namespaceqr__algorithm"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html">qr_algorithm</a></td></tr>
|
||||
<tr class="memdesc:d2/d3b/namespaceqr__algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition">QR decomposition</a> of any rectangular matrix. <br /></td></tr>
|
||||
<tr class="memitem:d2/d3b/namespaceqr__algorithm"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html">qr_algorithm</a></td></tr>
|
||||
<tr class="memdesc:d2/d3b/namespaceqr__algorithm"><td class="mdescLeft"> </td><td class="mdescRight">Functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition" target="_blank">QR decomposition</a> of any rectangular matrix. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a7c63c78d6839b8ad73b77c161210b514"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a7c63c78d6839b8ad73b77c161210b514"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a7c63c78d6839b8ad73b77c161210b514">qr_algorithm::operator<<</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T >> const &v)</td></tr>
|
||||
<tr class="separator:a7c63c78d6839b8ad73b77c161210b514"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a240edf2b6b5942c0e5f2c9d3e326797f"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a240edf2b6b5942c0e5f2c9d3e326797f"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a240edf2b6b5942c0e5f2c9d3e326797f">qr_algorithm::operator<<</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > const &v)</td></tr>
|
||||
<tr class="separator:a240edf2b6b5942c0e5f2c9d3e326797f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:adfbdf47277c8cfee229b05b72f1f7834"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:adfbdf47277c8cfee229b05b72f1f7834"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#adfbdf47277c8cfee229b05b72f1f7834">qr_algorithm::operator<<</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > > const &v)</td></tr>
|
||||
<tr class="separator:adfbdf47277c8cfee229b05b72f1f7834"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a257425cb2365359da51c6fe6741834d8"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a257425cb2365359da51c6fe6741834d8"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> & </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a257425cb2365359da51c6fe6741834d8">qr_algorithm::operator<<</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > const &v)</td></tr>
|
||||
<tr class="separator:a257425cb2365359da51c6fe6741834d8"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a8ea313a1a1b5f9d0e3e332c29c6446ec"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a8ea313a1a1b5f9d0e3e332c29c6446ec"><td class="memTemplItemLeft" align="right" valign="top">double </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">qr_algorithm::vector_dot</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &a, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &b)</td></tr>
|
||||
<tr class="separator:a8ea313a1a1b5f9d0e3e332c29c6446ec"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad16da2183db22378435042f26af43d5f"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:ad16da2183db22378435042f26af43d5f"><td class="memTemplItemLeft" align="right" valign="top">double </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">qr_algorithm::vector_mag</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &a)</td></tr>
|
||||
<tr class="separator:ad16da2183db22378435042f26af43d5f"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a5422c76bfa322620de611083bd518d71"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a5422c76bfa322620de611083bd518d71"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a5422c76bfa322620de611083bd518d71">qr_algorithm::vector_proj</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &a, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &b)</td></tr>
|
||||
<tr class="separator:a5422c76bfa322620de611083bd518d71"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab1ac74497ffb2101040cc1efe3546de8"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:ab1ac74497ffb2101040cc1efe3546de8"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#ab1ac74497ffb2101040cc1efe3546de8">qr_algorithm::qr_decompose</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T >> &A, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T >> *Q, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T >> *R)</td></tr>
|
||||
<tr class="separator:ab1ac74497ffb2101040cc1efe3546de8"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a6d3c7dce1f142141f509d09f6c0e25dc"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a6d3c7dce1f142141f509d09f6c0e25dc"><td class="memTemplItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a6d3c7dce1f142141f509d09f6c0e25dc">qr_algorithm::vector_proj</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &a, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > &b)</td></tr>
|
||||
<tr class="separator:a6d3c7dce1f142141f509d09f6c0e25dc"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a73ce637634fc49e1d10d190eb388ebf1"><td class="memTemplParams" colspan="2">template<typename T > </td></tr>
|
||||
<tr class="memitem:a73ce637634fc49e1d10d190eb388ebf1"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d2/d3b/namespaceqr__algorithm.html#a73ce637634fc49e1d10d190eb388ebf1">qr_algorithm::qr_decompose</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > > &A, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > > *Q, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a>< T > > *R)</td></tr>
|
||||
<tr class="separator:a73ce637634fc49e1d10d190eb388ebf1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Library functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition">QR decomposition</a> of a given matrix. </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
|
||||
<div class="textblock"><p >Library functions to compute <a href="https://en.wikipedia.org/wiki/QR_decomposition" target="_blank">QR decomposition</a> of a given matrix. </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala" target="_blank">Krishna Vedala</a> </dd></dl>
|
||||
</div></div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_9c6faab82c22511b50177aa2e38e2780.html">numerical_methods</a></li><li class="navelem"><a class="el" href="../../d4/d68/qr__decompose_8h.html">qr_decompose.h</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var qr__decompose_8h =
|
||||
[
|
||||
[ "operator<<", "d4/d68/qr__decompose_8h.html#a7c63c78d6839b8ad73b77c161210b514", null ],
|
||||
[ "operator<<", "d4/d68/qr__decompose_8h.html#a240edf2b6b5942c0e5f2c9d3e326797f", null ],
|
||||
[ "qr_decompose", "d4/d68/qr__decompose_8h.html#ab1ac74497ffb2101040cc1efe3546de8", null ],
|
||||
[ "operator<<", "d4/d68/qr__decompose_8h.html#adfbdf47277c8cfee229b05b72f1f7834", null ],
|
||||
[ "operator<<", "d4/d68/qr__decompose_8h.html#a257425cb2365359da51c6fe6741834d8", null ],
|
||||
[ "qr_decompose", "d4/d68/qr__decompose_8h.html#a73ce637634fc49e1d10d190eb388ebf1", null ],
|
||||
[ "vector_dot", "d4/d68/qr__decompose_8h.html#a8ea313a1a1b5f9d0e3e332c29c6446ec", null ],
|
||||
[ "vector_mag", "d4/d68/qr__decompose_8h.html#ad16da2183db22378435042f26af43d5f", null ],
|
||||
[ "vector_proj", "d4/d68/qr__decompose_8h.html#a5422c76bfa322620de611083bd518d71", null ]
|
||||
[ "vector_proj", "d4/d68/qr__decompose_8h.html#a6d3c7dce1f142141f509d09f6c0e25dc", null ]
|
||||
];
|
||||
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: numerical_methods/qr_decompose.h Source File</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -90,230 +90,229 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">qr_decompose.h</div> </div>
|
||||
<div class="headertitle"><div class="title">qr_decompose.h</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<a href="../../d4/d68/qr__decompose_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * @file</span></div>
|
||||
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * \brief Library functions to compute [QR</span></div>
|
||||
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * decomposition](https://en.wikipedia.org/wiki/QR_decomposition) of a given</span></div>
|
||||
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * matrix.</span></div>
|
||||
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * \author [Krishna Vedala](https://github.com/kvedala)</span></div>
|
||||
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  </div>
|
||||
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#ifndef NUMERICAL_METHODS_QR_DECOMPOSE_H_</span></div>
|
||||
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#define NUMERICAL_METHODS_QR_DECOMPOSE_H_</span></div>
|
||||
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  </div>
|
||||
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <cmath></span></div>
|
||||
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <cstdlib></span></div>
|
||||
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <iomanip></span></div>
|
||||
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <iostream></span></div>
|
||||
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include <limits></span></div>
|
||||
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <numeric></span></div>
|
||||
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <valarray></span></div>
|
||||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <omp.h></span></div>
|
||||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html"> 23</a></span> <span class="comment">/** \namespace qr_algorithm</span></div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * \brief Functions to compute [QR</span></div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment"> * decomposition](https://en.wikipedia.org/wiki/QR_decomposition) of any</span></div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> * rectangular matrix</span></div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="keyword">namespace </span><a class="code" href="../../d2/d3b/namespaceqr__algorithm.html">qr_algorithm</a> {<span class="comment"></span></div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="comment"> * operator to print a matrix</span></div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a7c63c78d6839b8ad73b77c161210b514"> 33</a></span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &<a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a7c63c78d6839b8ad73b77c161210b514">operator<<</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out,</div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> <span class="keyword">const</span> &v) {</div>
|
||||
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> width = 12;</div>
|
||||
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> separator = <span class="charliteral">' '</span>;</div>
|
||||
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  </div>
|
||||
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  out.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/ios_base/precision.html">precision</a>(4);</div>
|
||||
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row < v.size(); row++) {</div>
|
||||
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col < v[row].size(); col++)</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  out << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/left.html">std::right</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setw.html">std::setw</a>(width) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a>(separator)</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  << v[row][col];</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  out << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  }</div>
|
||||
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  </div>
|
||||
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">return</span> out;</div>
|
||||
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> }</div>
|
||||
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="comment"> * operator to print a vector</span></div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a240edf2b6b5942c0e5f2c9d3e326797f"> 53</a></span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &<a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a7c63c78d6839b8ad73b77c161210b514">operator<<</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> <span class="keyword">const</span> &v) {</div>
|
||||
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> width = 10;</div>
|
||||
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> separator = <span class="charliteral">' '</span>;</div>
|
||||
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  </div>
|
||||
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  out.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/ios_base/precision.html">precision</a>(4);</div>
|
||||
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row < v.size(); row++) {</div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  out << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/left.html">std::right</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setw.html">std::setw</a>(width) << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a>(separator)</div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  << v[row];</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  }</div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  </div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> out;</div>
|
||||
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> }</div>
|
||||
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="comment"> * Compute dot product of two vectors of equal lengths</span></div>
|
||||
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="comment"> * If \f$\vec{a}=\left[a_0,a_1,a_2,...,a_L\right]\f$ and</span></div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> <span class="comment"> * \f$\vec{b}=\left[b_0,b_1,b_1,...,b_L\right]\f$ then</span></div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> <span class="comment"> * \f$\vec{a}\cdot\vec{b}=\displaystyle\sum_{i=0}^L a_i\times b_i\f$</span></div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="comment"> * \returns \f$\vec{a}\cdot\vec{b}\f$</span></div>
|
||||
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec"> 76</a></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(<span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a, <span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &b) {</div>
|
||||
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="keywordflow">return</span> (a * b).sum();</div>
|
||||
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">// could also use following</span></div>
|
||||
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// return std::inner_product(std::begin(a), std::end(a), std::begin(b),</span></div>
|
||||
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment">// 0.f);</span></div>
|
||||
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> }</div>
|
||||
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"> * Compute magnitude of vector.</span></div>
|
||||
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"> * If \f$\vec{a}=\left[a_0,a_1,a_2,...,a_L\right]\f$ then</span></div>
|
||||
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="comment"> * \f$\left|\vec{a}\right|=\sqrt{\displaystyle\sum_{i=0}^L a_i^2}\f$</span></div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment"> * \returns \f$\left|\vec{a}\right|\f$</span></div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f"> 92</a></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">vector_mag</a>(<span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a) {</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordtype">double</span> dot = <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(a, a);</div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">return</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(dot);</div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> }</div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="comment"> * Compute projection of vector \f$\vec{a}\f$ on \f$\vec{b}\f$ defined as</span></div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="comment"> * \f[\text{proj}_\vec{b}\vec{a}=\frac{\vec{a}\cdot\vec{b}}{\left|\vec{b}\right|^2}\vec{b}\f]</span></div>
|
||||
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment"> * \returns NULL if error, otherwise pointer to output</span></div>
|
||||
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a5422c76bfa322620de611083bd518d71"> 104</a></span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a5422c76bfa322620de611083bd518d71">vector_proj</a>(<span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a,</div>
|
||||
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &b) {</div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordtype">double</span> num = <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(a, b);</div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">double</span> deno = <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(b, b);</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment"> /*! check for division by zero using machine epsilon */</span></div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span> (deno <= <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits<double>::epsilon</a>()) {</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> << <span class="stringliteral">"["</span> << __func__ << <span class="stringliteral">"] Possible division by zero\n"</span>;</div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">return</span> a; <span class="comment">// return vector a back</span></div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  }</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  </div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordtype">double</span> scalar = num / deno;</div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  </div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">return</span> b * scalar;</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> }</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="comment"></span> </div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="comment">/**</span></div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="comment"> * Decompose matrix \f$A\f$ using [Gram-Schmidt</span></div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="comment"> *process](https://en.wikipedia.org/wiki/QR_decomposition).</span></div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="comment"> *</span></div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="comment"> * \f{eqnarray*}{</span></div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="comment"> * \text{given that}\quad A &=&</span></div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="comment"> *\left[\mathbf{a}_1,\mathbf{a}_2,\ldots,\mathbf{a}_{N-1},\right]\\</span></div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <span class="comment"> * \text{where}\quad\mathbf{a}_i &=&</span></div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="comment"> * \left[a_{0i},a_{1i},a_{2i},\ldots,a_{(M-1)i}\right]^T\quad\ldots\mbox{(column</span></div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="comment"> * vectors)}\\</span></div>
|
||||
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="comment"> * \text{then}\quad\mathbf{u}_i &=& \mathbf{a}_i</span></div>
|
||||
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="comment"> *-\sum_{j=0}^{i-1}\text{proj}_{\mathbf{u}_j}\mathbf{a}_i\\</span></div>
|
||||
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="comment"> * \mathbf{e}_i &=&\frac{\mathbf{u}_i}{\left|\mathbf{u}_i\right|}\\</span></div>
|
||||
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="comment"> * Q &=& \begin{bmatrix}\mathbf{e}_0 & \mathbf{e}_1 & \mathbf{e}_2 & \dots &</span></div>
|
||||
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="comment"> * \mathbf{e}_{N-1}\end{bmatrix}\\</span></div>
|
||||
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span> <span class="comment"> * R &=& \begin{bmatrix}\langle\mathbf{e}_0\,,\mathbf{a}_0\rangle &</span></div>
|
||||
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> <span class="comment"> * \langle\mathbf{e}_1\,,\mathbf{a}_1\rangle &</span></div>
|
||||
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="comment"> * \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle & \dots \\</span></div>
|
||||
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="comment"> * 0 & \langle\mathbf{e}_1\,,\mathbf{a}_1\rangle &</span></div>
|
||||
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="comment"> * \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle & \dots\\</span></div>
|
||||
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="comment"> * 0 & 0 & \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle &</span></div>
|
||||
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="comment"> * \dots\\ \vdots & \vdots & \vdots & \ddots</span></div>
|
||||
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span> <span class="comment"> * \end{bmatrix}\\</span></div>
|
||||
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="comment"> * \f}</span></div>
|
||||
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="comment"> */</span></div>
|
||||
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#ab1ac74497ffb2101040cc1efe3546de8"> 146</a></span> <span class="keywordtype">void</span> <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#ab1ac74497ffb2101040cc1efe3546de8">qr_decompose</a>(</div>
|
||||
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keyword">const</span> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> &A, <span class="comment">/**< input matrix to decompose */</span></div>
|
||||
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> *Q, <span class="comment">/**< output decomposed matrix */</span></div>
|
||||
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> *R <span class="comment">/**< output decomposed matrix */</span></div>
|
||||
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span> ) {</div>
|
||||
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> ROWS = A.size(); <span class="comment">// number of rows of A</span></div>
|
||||
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> COLUMNS = A[0].size(); <span class="comment">// number of columns of A</span></div>
|
||||
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> col_vector(ROWS);</div>
|
||||
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> col_vector2(ROWS);</div>
|
||||
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> tmp_vector(ROWS);</div>
|
||||
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  </div>
|
||||
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < COLUMNS; i++) {</div>
|
||||
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="comment">/* for each column => R is a square matrix of NxN */</span></div>
|
||||
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordtype">int</span> j;</div>
|
||||
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  R[0][i] = 0.; <span class="comment">/* make R upper triangular */</span></div>
|
||||
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  </div>
|
||||
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="comment">/* get corresponding Q vector */</span></div>
|
||||
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordflow">for</span> (j = 0; j < ROWS; j++) {</div>
|
||||
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  tmp_vector[j] = A[j][i]; <span class="comment">/* accumulator for uk */</span></div>
|
||||
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  col_vector[j] = A[j][i];</div>
|
||||
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  }</div>
|
||||
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">for</span> (j = 0; j < i; j++) {</div>
|
||||
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k < ROWS; k++) {</div>
|
||||
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  col_vector2[k] = Q[0][k][j];</div>
|
||||
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  }</div>
|
||||
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  col_vector2 = <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#a5422c76bfa322620de611083bd518d71">vector_proj</a>(col_vector, col_vector2);</div>
|
||||
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  tmp_vector -= col_vector2;</div>
|
||||
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  }</div>
|
||||
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  </div>
|
||||
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordtype">double</span> mag = <a class="code" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">vector_mag</a>(tmp_vector);</div>
|
||||
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  </div>
|
||||
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span> <span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span> <span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <span class="keywordflow">for</span> (j = 0; j < ROWS; j++) Q[0][j][i] = tmp_vector[j] / mag;</div>
|
||||
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  </div>
|
||||
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <span class="comment">/* compute upper triangular values of R */</span></div>
|
||||
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span> <span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> kk = 0; kk < ROWS; kk++) {</div>
|
||||
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  col_vector[kk] = Q[0][kk][i];</div>
|
||||
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  }</div>
|
||||
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  </div>
|
||||
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span> <span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span> <span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span> <span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span> <span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = i; k < COLUMNS; k++) {</div>
|
||||
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> kk = 0; kk < ROWS; kk++) {</div>
|
||||
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  col_vector2[kk] = A[kk][k];</div>
|
||||
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  }</div>
|
||||
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  R[0][i][k] = (col_vector * col_vector2).<a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a>();</div>
|
||||
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  }</div>
|
||||
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  }</div>
|
||||
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span> }</div>
|
||||
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span> } <span class="comment">// namespace qr_algorithm</span></div>
|
||||
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  </div>
|
||||
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span> <span class="preprocessor">#endif </span><span class="comment">// NUMERICAL_METHODS_QR_DECOMPOSE_H_</span></div>
|
||||
<a href="../../d4/d68/qr__decompose_8h.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><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment"> * @file</span></div>
|
||||
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment"> * \brief Library functions to compute [QR</span></div>
|
||||
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment"> * decomposition](https://en.wikipedia.org/wiki/QR_decomposition) of a given</span></div>
|
||||
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment"> * matrix.</span></div>
|
||||
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment"> * \author [Krishna Vedala](https://github.com/kvedala)</span></div>
|
||||
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> </div>
|
||||
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#ifndef NUMERICAL_METHODS_QR_DECOMPOSE_H_</span></div>
|
||||
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#define NUMERICAL_METHODS_QR_DECOMPOSE_H_</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 <cmath></span></div>
|
||||
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include <cstdlib></span></div>
|
||||
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include <iomanip></span></div>
|
||||
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include <iostream></span></div>
|
||||
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include <limits></span></div>
|
||||
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include <numeric></span></div>
|
||||
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include <valarray></span></div>
|
||||
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include <omp.h></span></div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html"> 23</a></span><span class="comment">/** \namespace qr_algorithm</span></div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="comment"> * \brief Functions to compute [QR</span></div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="comment"> * decomposition](https://en.wikipedia.org/wiki/QR_decomposition) of any</span></div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="comment"> * rectangular matrix</span></div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d2/d3b/namespaceqr__algorithm.html">qr_algorithm</a> {<span class="comment"></span></div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="comment"> * operator to print a matrix</span></div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#adfbdf47277c8cfee229b05b72f1f7834"> 33</a></span><a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &<a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#adfbdf47277c8cfee229b05b72f1f7834">operator<<</a>(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out,</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> <span class="keyword">const</span> &v) {</div>
|
||||
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">const</span> <span class="keywordtype">int</span> width = 12;</div>
|
||||
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keyword">const</span> <span class="keywordtype">char</span> separator = <span class="charliteral">' '</span>;</div>
|
||||
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
|
||||
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> out.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/ios_base/precision.html">precision</a>(4);</div>
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row < v.size(); row++) {</div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> col = 0; col < v[row].size(); col++)</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> out << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/left.html">std::right</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setw.html">std::setw</a>(width) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a>(separator)</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> << v[row][col];</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> out << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> }</div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">return</span> out;</div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>}</div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="comment"> * operator to print a vector</span></div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a257425cb2365359da51c6fe6741834d8"> 53</a></span><a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &<a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#adfbdf47277c8cfee229b05b72f1f7834">operator<<</a>(<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a> &out, <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> <span class="keyword">const</span> &v) {</div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keyword">const</span> <span class="keywordtype">int</span> width = 10;</div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keyword">const</span> <span class="keywordtype">char</span> separator = <span class="charliteral">' '</span>;</div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> </div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> out.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/ios_base/precision.html">precision</a>(4);</div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> row = 0; row < v.size(); row++) {</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> out << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/left.html">std::right</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setw.html">std::setw</a>(width) << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a>(separator)</div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> << v[row];</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> }</div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">return</span> out;</div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>}</div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span><span class="comment"> * Compute dot product of two vectors of equal lengths</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span><span class="comment"> * If \f$\vec{a}=\left[a_0,a_1,a_2,...,a_L\right]\f$ and</span></div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="comment"> * \f$\vec{b}=\left[b_0,b_1,b_1,...,b_L\right]\f$ then</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="comment"> * \f$\vec{a}\cdot\vec{b}=\displaystyle\sum_{i=0}^L a_i\times b_i\f$</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span><span class="comment"> * \returns \f$\vec{a}\cdot\vec{b}\f$</span></div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec"> 76</a></span><span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a, <span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &b) {</div>
|
||||
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">return</span> (a * b).sum();</div>
|
||||
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="comment">// could also use following</span></div>
|
||||
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="comment">// return std::inner_product(std::begin(a), std::end(a), std::begin(b),</span></div>
|
||||
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// 0.f);</span></div>
|
||||
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span>}</div>
|
||||
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span><span class="comment"> * Compute magnitude of vector.</span></div>
|
||||
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span><span class="comment"> * If \f$\vec{a}=\left[a_0,a_1,a_2,...,a_L\right]\f$ then</span></div>
|
||||
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span><span class="comment"> * \f$\left|\vec{a}\right|=\sqrt{\displaystyle\sum_{i=0}^L a_i^2}\f$</span></div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span><span class="comment"> * \returns \f$\left|\vec{a}\right|\f$</span></div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f"> 92</a></span><span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">vector_mag</a>(<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a) {</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">double</span> dot = <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(a, a);</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(dot);</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span>}</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span><span class="comment"> * Compute projection of vector \f$\vec{a}\f$ on \f$\vec{b}\f$ defined as</span></div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span><span class="comment"> * \f[\text{proj}_\vec{b}\vec{a}=\frac{\vec{a}\cdot\vec{b}}{\left|\vec{b}\right|^2}\vec{b}\f]</span></div>
|
||||
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span><span class="comment"> * \returns NULL if error, otherwise pointer to output</span></div>
|
||||
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a6d3c7dce1f142141f509d09f6c0e25dc"> 104</a></span><a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a6d3c7dce1f142141f509d09f6c0e25dc">vector_proj</a>(<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &a,</div>
|
||||
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> &b) {</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">double</span> num = <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(a, b);</div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">double</span> deno = <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">vector_dot</a>(b, b);</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span><span class="comment"> /*! check for division by zero using machine epsilon */</span></div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">if</span> (deno <= <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits<double>::epsilon</a>()) {</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cerr</a> << <span class="stringliteral">"["</span> << __func__ << <span class="stringliteral">"] Possible division by zero\n"</span>;</div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> a; <span class="comment">// return vector a back</span></div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> }</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="keywordtype">double</span> scalar = num / deno;</div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordflow">return</span> b * scalar;</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span>}</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span><span class="comment"></span> </div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span><span class="comment">/**</span></div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span><span class="comment"> * Decompose matrix \f$A\f$ using [Gram-Schmidt</span></div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span><span class="comment"> *process](https://en.wikipedia.org/wiki/QR_decomposition).</span></div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span><span class="comment"> *</span></div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span><span class="comment"> * \f{eqnarray*}{</span></div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span><span class="comment"> * \text{given that}\quad A &=&</span></div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span><span class="comment"> *\left[\mathbf{a}_1,\mathbf{a}_2,\ldots,\mathbf{a}_{N-1},\right]\\</span></div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span><span class="comment"> * \text{where}\quad\mathbf{a}_i &=&</span></div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span><span class="comment"> * \left[a_{0i},a_{1i},a_{2i},\ldots,a_{(M-1)i}\right]^T\quad\ldots\mbox{(column</span></div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span><span class="comment"> * vectors)}\\</span></div>
|
||||
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span><span class="comment"> * \text{then}\quad\mathbf{u}_i &=& \mathbf{a}_i</span></div>
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span><span class="comment"> *-\sum_{j=0}^{i-1}\text{proj}_{\mathbf{u}_j}\mathbf{a}_i\\</span></div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span><span class="comment"> * \mathbf{e}_i &=&\frac{\mathbf{u}_i}{\left|\mathbf{u}_i\right|}\\</span></div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span><span class="comment"> * Q &=& \begin{bmatrix}\mathbf{e}_0 & \mathbf{e}_1 & \mathbf{e}_2 & \dots &</span></div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span><span class="comment"> * \mathbf{e}_{N-1}\end{bmatrix}\\</span></div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span><span class="comment"> * R &=& \begin{bmatrix}\langle\mathbf{e}_0\,,\mathbf{a}_0\rangle &</span></div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span><span class="comment"> * \langle\mathbf{e}_1\,,\mathbf{a}_1\rangle &</span></div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span><span class="comment"> * \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle & \dots \\</span></div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span><span class="comment"> * 0 & \langle\mathbf{e}_1\,,\mathbf{a}_1\rangle &</span></div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span><span class="comment"> * \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle & \dots\\</span></div>
|
||||
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span><span class="comment"> * 0 & 0 & \langle\mathbf{e}_2\,,\mathbf{a}_2\rangle &</span></div>
|
||||
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span><span class="comment"> * \dots\\ \vdots & \vdots & \vdots & \ddots</span></div>
|
||||
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span><span class="comment"> * \end{bmatrix}\\</span></div>
|
||||
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span><span class="comment"> * \f}</span></div>
|
||||
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span><span class="comment"> */</span></div>
|
||||
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span><span class="keyword">template</span> <<span class="keyword">typename</span> T></div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"><a class="line" href="../../d2/d3b/namespaceqr__algorithm.html#a73ce637634fc49e1d10d190eb388ebf1"> 146</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a73ce637634fc49e1d10d190eb388ebf1">qr_decompose</a>(</div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> &A, <span class="comment">/**< input matrix to decompose */</span></div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> *Q, <span class="comment">/**< output decomposed matrix */</span></div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray</a><<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a>> *R <span class="comment">/**< output decomposed matrix */</span></div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span>) {</div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> ROWS = A.size(); <span class="comment">// number of rows of A</span></div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/size_t.html">std::size_t</a> COLUMNS = A[0].size(); <span class="comment">// number of columns of A</span></div>
|
||||
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> col_vector(ROWS);</div>
|
||||
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> col_vector2(ROWS);</div>
|
||||
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/valarray.html">std::valarray<T></a> tmp_vector(ROWS);</div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> </div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < COLUMNS; i++) {</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="comment">/* for each column => R is a square matrix of NxN */</span></div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordtype">int</span> j;</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> R[0][i] = 0.; <span class="comment">/* make R upper triangular */</span></div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> </div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="comment">/* get corresponding Q vector */</span></div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span><span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span><span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span><span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <span class="keywordflow">for</span> (j = 0; j < ROWS; j++) {</div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> tmp_vector[j] = A[j][i]; <span class="comment">/* accumulator for uk */</span></div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> col_vector[j] = A[j][i];</div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> }</div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <span class="keywordflow">for</span> (j = 0; j < i; j++) {</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k < ROWS; k++) {</div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> col_vector2[k] = Q[0][k][j];</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> }</div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> col_vector2 = <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#a6d3c7dce1f142141f509d09f6c0e25dc">vector_proj</a>(col_vector, col_vector2);</div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> tmp_vector -= col_vector2;</div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> }</div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="keywordtype">double</span> mag = <a class="code hl_function" href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">vector_mag</a>(tmp_vector);</div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> </div>
|
||||
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span><span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span><span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span><span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordflow">for</span> (j = 0; j < ROWS; j++) Q[0][j][i] = tmp_vector[j] / mag;</div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> </div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="comment">/* compute upper triangular values of R */</span></div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span><span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span><span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span><span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> kk = 0; kk < ROWS; kk++) {</div>
|
||||
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> col_vector[kk] = Q[0][kk][i];</div>
|
||||
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> }</div>
|
||||
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> </div>
|
||||
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span><span class="preprocessor">#ifdef _OPENMP</span></div>
|
||||
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span><span class="comment">// parallelize on threads</span></div>
|
||||
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span><span class="preprocessor">#pragma omp for</span></div>
|
||||
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = i; k < COLUMNS; k++) {</div>
|
||||
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> kk = 0; kk < ROWS; kk++) {</div>
|
||||
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> col_vector2[kk] = A[kk][k];</div>
|
||||
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> }</div>
|
||||
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> R[0][i][k] = (col_vector * col_vector2).<a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a>();</div>
|
||||
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> }</div>
|
||||
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> }</div>
|
||||
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span>}</div>
|
||||
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span>} <span class="comment">// namespace qr_algorithm</span></div>
|
||||
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
|
||||
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span><span class="preprocessor">#endif </span><span class="comment">// NUMERICAL_METHODS_QR_DECOMPOSE_H_</span></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::ostream</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="aleft_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/left.html">std::right</a></div><div class="ttdeci">T right(T... args)</div></div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a5305cc18d11943d3dc0d66e70d7e9c44"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T >> &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a6f1c98c016ad34ff3d9f39372161bd35"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T > > &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html">qr_algorithm</a></div><div class="ttdoc">Functions to compute QR decomposition of any rectangular matrix.</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_a5422c76bfa322620de611083bd518d71"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#a5422c76bfa322620de611083bd518d71">qr_algorithm::vector_proj</a></div><div class="ttdeci">std::valarray< T > vector_proj(const std::valarray< T > &a, const std::valarray< T > &b)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:104</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_a7c63c78d6839b8ad73b77c161210b514"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#a7c63c78d6839b8ad73b77c161210b514">qr_algorithm::operator<<</a></div><div class="ttdeci">std::ostream & operator<<(std::ostream &out, std::valarray< std::valarray< T >> const &v)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:33</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_a6d3c7dce1f142141f509d09f6c0e25dc"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#a6d3c7dce1f142141f509d09f6c0e25dc">qr_algorithm::vector_proj</a></div><div class="ttdeci">std::valarray< T > vector_proj(const std::valarray< T > &a, const std::valarray< T > &b)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:104</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_a73ce637634fc49e1d10d190eb388ebf1"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#a73ce637634fc49e1d10d190eb388ebf1">qr_algorithm::qr_decompose</a></div><div class="ttdeci">void qr_decompose(const std::valarray< std::valarray< T > > &A, std::valarray< std::valarray< T > > *Q, std::valarray< std::valarray< T > > *R)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:146</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_a8ea313a1a1b5f9d0e3e332c29c6446ec"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#a8ea313a1a1b5f9d0e3e332c29c6446ec">qr_algorithm::vector_dot</a></div><div class="ttdeci">double vector_dot(const std::valarray< T > &a, const std::valarray< T > &b)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:76</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_ab1ac74497ffb2101040cc1efe3546de8"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#ab1ac74497ffb2101040cc1efe3546de8">qr_algorithm::qr_decompose</a></div><div class="ttdeci">void qr_decompose(const std::valarray< std::valarray< T >> &A, std::valarray< std::valarray< T >> *Q, std::valarray< std::valarray< T >> *R)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:146</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_ad16da2183db22378435042f26af43d5f"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#ad16da2183db22378435042f26af43d5f">qr_algorithm::vector_mag</a></div><div class="ttdeci">double vector_mag(const std::valarray< T > &a)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:92</div></div>
|
||||
<div class="ttc" id="anamespaceqr__algorithm_html_adfbdf47277c8cfee229b05b72f1f7834"><div class="ttname"><a href="../../d2/d3b/namespaceqr__algorithm.html#adfbdf47277c8cfee229b05b72f1f7834">qr_algorithm::operator<<</a></div><div class="ttdeci">std::ostream & operator<<(std::ostream &out, std::valarray< std::valarray< T > > const &v)</div><div class="ttdef"><b>Definition:</b> qr_decompose.h:33</div></div>
|
||||
<div class="ttc" id="anumeric_limits_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/types/numeric_limits.html">std::numeric_limits</a></div></div>
|
||||
<div class="ttc" id="aprecision_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/ios_base/precision.html">std::ostream::precision</a></div><div class="ttdeci">T precision(T... args)</div></div>
|
||||
<div class="ttc" id="asetfill_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/setfill.html">std::setfill</a></div><div class="ttdeci">T setfill(T... args)</div></div>
|
||||
@@ -327,7 +326,7 @@ $(document).ready(function(){initNavTree('d4/d68/qr__decompose_8h_source.html','
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_9c6faab82c22511b50177aa2e38e2780.html">numerical_methods</a></li><li class="navelem"><a class="el" href="../../d4/d68/qr__decompose_8h.html">qr_decompose.h</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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: numerical_methods/qr_eigen_values.cpp Pages: 1 -->
|
||||
<svg width="478pt" height="151pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: data_structures/skip_list.cpp Pages: 1 -->
|
||||
<svg width="377pt" height="95pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: sorting/shell_sort2.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d7a/shell__sort2_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d4/d7a/shell__sort2_8cpp.html','../../
|
||||
<div class="summary">
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">shell_sort2.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">shell_sort2.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a href="https://en.wikipedia.org/wiki/Shell_sort">Shell sort</a> algorithm
|
||||
<p><a href="https://en.wikipedia.org/wiki/Shell_sort" target="_blank">Shell sort</a> algorithm
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <cassert></code><br />
|
||||
<code>#include <cstdlib></code><br />
|
||||
@@ -113,13 +112,13 @@ Include dependency graph for shell_sort2.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
|
||||
Namespaces</h2></td></tr>
|
||||
<tr class="memitem:d5/d91/namespacesorting"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d91/namespacesorting.html">sorting</a></td></tr>
|
||||
<tr class="memitem:d5/d91/namespacesorting"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d91/namespacesorting.html">sorting</a></td></tr>
|
||||
<tr class="memdesc:d5/d91/namespacesorting"><td class="mdescLeft"> </td><td class="mdescRight">Sorting algorithms. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a951127aea9d7e1e53ea9ae0868633246"><td class="memTemplParams" colspan="2">template<class T > </td></tr>
|
||||
<tr class="memitem:a951127aea9d7e1e53ea9ae0868633246"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a> (T *arr, size_t LEN)</td></tr>
|
||||
@@ -147,10 +146,10 @@ Functions</h2></td></tr>
|
||||
<tr class="separator:a0ddf1224851353fc92bfbff6f499fa97"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Shell_sort">Shell sort</a> algorithm </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala">Krishna Vedala</a> </dd></dl>
|
||||
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Shell_sort" target="_blank">Shell sort</a> algorithm </p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/kvedala" target="_blank">Krishna Vedala</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a7eb77daed2cf1513f6d68c47a1c2db1c"></a>
|
||||
<a id="a7eb77daed2cf1513f6d68c47a1c2db1c" name="a7eb77daed2cf1513f6d68c47a1c2db1c"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a7eb77daed2cf1513f6d68c47a1c2db1c">◆ </a></span>compare()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -177,24 +176,24 @@ template<typename T > </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>function to compare sorting using cstdlib's qsort </p>
|
||||
<div class="fragment"><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  {</div>
|
||||
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  T arg1 = *<span class="keyword">static_cast<</span><span class="keyword">const </span>T *<span class="keyword">></span>(a);</div>
|
||||
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  T arg2 = *<span class="keyword">static_cast<</span><span class="keyword">const </span>T *<span class="keyword">></span>(b);</div>
|
||||
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  </div>
|
||||
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (arg1 < arg2)</div>
|
||||
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">return</span> -1;</div>
|
||||
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">if</span> (arg1 > arg2)</div>
|
||||
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">return</span> 1;</div>
|
||||
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  </div>
|
||||
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="comment">// return (arg1 > arg2) - (arg1 < arg2); // possible shortcut</span></div>
|
||||
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="comment">// return arg1 - arg2; // erroneous shortcut (fails if INT_MIN is present)</span></div>
|
||||
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> }</div>
|
||||
<p >function to compare sorting using cstdlib's qsort </p>
|
||||
<div class="fragment"><div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> {</div>
|
||||
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> T arg1 = *<span class="keyword">static_cast<</span><span class="keyword">const </span>T *<span class="keyword">></span>(a);</div>
|
||||
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> T arg2 = *<span class="keyword">static_cast<</span><span class="keyword">const </span>T *<span class="keyword">></span>(b);</div>
|
||||
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
|
||||
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keywordflow">if</span> (arg1 < arg2)</div>
|
||||
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">return</span> -1;</div>
|
||||
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordflow">if</span> (arg1 > arg2)</div>
|
||||
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">return</span> 1;</div>
|
||||
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> </div>
|
||||
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// return (arg1 > arg2) - (arg1 < arg2); // possible shortcut</span></div>
|
||||
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// return arg1 - arg2; // erroneous shortcut (fails if INT_MIN is present)</span></div>
|
||||
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span>}</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97" name="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -219,59 +218,59 @@ template<typename T > </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  {</div>
|
||||
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="comment">// initialize random number generator - once per program</span></div>
|
||||
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">std::time</a>(NULL));</div>
|
||||
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  </div>
|
||||
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(100); <span class="comment">// test with sorting random array of 100 values</span></div>
|
||||
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 1 - 100 int values - passed. \n"</span>;</div>
|
||||
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(1000); <span class="comment">// test with sorting random array of 1000 values</span></div>
|
||||
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 2 - 1000 int values - passed.\n"</span>;</div>
|
||||
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(10000); <span class="comment">// test with sorting random array of 10000 values</span></div>
|
||||
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 3 - 10000 int values - passed.\n"</span>;</div>
|
||||
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  </div>
|
||||
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(100); <span class="comment">// test with sorting random array of 100 values</span></div>
|
||||
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 1 - 100 float values - passed. \n"</span>;</div>
|
||||
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(1000); <span class="comment">// test with sorting random array of 1000 values</span></div>
|
||||
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 2 - 1000 float values - passed.\n"</span>;</div>
|
||||
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(10000); <span class="comment">// test with sorting random array of 10000 values</span></div>
|
||||
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Test 3 - 10000 float values - passed.\n"</span>;</div>
|
||||
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  </div>
|
||||
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  <span class="keywordtype">int</span> i, NUM_DATA;</div>
|
||||
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  </div>
|
||||
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">if</span> (argc == 2)</div>
|
||||
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  NUM_DATA = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">atoi</a>(argv[1]);</div>
|
||||
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordflow">else</span></div>
|
||||
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  NUM_DATA = 200;</div>
|
||||
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  </div>
|
||||
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordtype">int</span> *<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordtype">int</span> range = 1800;</div>
|
||||
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  </div>
|
||||
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">time</a>(NULL));</div>
|
||||
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keywordflow">for</span> (i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <span class="comment">// allocate random numbers in the given range</span></div>
|
||||
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = (<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1);</div>
|
||||
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  }</div>
|
||||
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  </div>
|
||||
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Unsorted original data: "</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  <a class="code" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA); <span class="comment">// perform sorting</span></div>
|
||||
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  </div>
|
||||
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div>
|
||||
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  << <span class="stringliteral">"Data Sorted using custom implementation: "</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  </div>
|
||||
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keywordtype">double</span> elapsed_time = (<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) * 1.f / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Time spent sorting: "</span> << elapsed_time << <span class="stringliteral">"s\n"</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  </div>
|
||||
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keyword">delete</span>[] <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span> }</div>
|
||||
<p >Main function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> {</div>
|
||||
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="comment">// initialize random number generator - once per program</span></div>
|
||||
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">std::time</a>(NULL));</div>
|
||||
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> </div>
|
||||
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(100); <span class="comment">// test with sorting random array of 100 values</span></div>
|
||||
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</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 - 100 int values - passed. \n"</span>;</div>
|
||||
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(1000); <span class="comment">// test with sorting random array of 1000 values</span></div>
|
||||
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</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 2 - 1000 int values - passed.\n"</span>;</div>
|
||||
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a895b313cb2671e8f712040460325573e">test_int</a>(10000); <span class="comment">// test with sorting random array of 10000 values</span></div>
|
||||
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</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 3 - 10000 int values - passed.\n"</span>;</div>
|
||||
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> </div>
|
||||
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(100); <span class="comment">// test with sorting random array of 100 values</span></div>
|
||||
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</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 - 100 float values - passed. \n"</span>;</div>
|
||||
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(1000); <span class="comment">// test with sorting random array of 1000 values</span></div>
|
||||
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</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 2 - 1000 float values - passed.\n"</span>;</div>
|
||||
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a22ea0d1f7943ebb4371d31e44b465b6d">test_f</a>(10000); <span class="comment">// test with sorting random array of 10000 values</span></div>
|
||||
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</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 3 - 10000 float values - passed.\n"</span>;</div>
|
||||
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> </div>
|
||||
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="keywordtype">int</span> i, NUM_DATA;</div>
|
||||
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> </div>
|
||||
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <span class="keywordflow">if</span> (argc == 2)</div>
|
||||
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> NUM_DATA = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">atoi</a>(argv[1]);</div>
|
||||
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> <span class="keywordflow">else</span></div>
|
||||
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> NUM_DATA = 200;</div>
|
||||
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> </div>
|
||||
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> <span class="keywordtype">int</span> *<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> <span class="keywordtype">int</span> range = 1800;</div>
|
||||
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> </div>
|
||||
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/srand.html">std::srand</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/time.html">time</a>(NULL));</div>
|
||||
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">for</span> (i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <span class="comment">// allocate random numbers in the given range</span></div>
|
||||
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1);</div>
|
||||
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> }</div>
|
||||
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> </div>
|
||||
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</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">"Unsorted original data: "</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <a class="code hl_function" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA); <span class="comment">// perform sorting</span></div>
|
||||
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> </div>
|
||||
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div>
|
||||
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> << <span class="stringliteral">"Data Sorted using custom implementation: "</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> </div>
|
||||
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="keywordtype">double</span> elapsed_time = (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) * 1.f / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</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">"Time spent sorting: "</span> << elapsed_time << <span class="stringliteral">"s\n"</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> </div>
|
||||
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> <span class="keyword">delete</span>[] <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span>}</div>
|
||||
<div class="ttc" id="aatoi_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">std::atoi</a></div><div class="ttdeci">T atoi(T... args)</div></div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aclock_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a></div><div class="ttdeci">T clock(T... args)</div></div>
|
||||
@@ -295,7 +294,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a951127aea9d7e1e53ea9ae0868633246"></a>
|
||||
<a id="a951127aea9d7e1e53ea9ae0868633246" name="a951127aea9d7e1e53ea9ae0868633246"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a951127aea9d7e1e53ea9ae0868633246">◆ </a></span>show_data() <span class="overload">[1/2]</span></h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -322,21 +321,21 @@ template<class T > </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>pretty print array </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >pretty print array </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">arr</td><td>array to print </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">LEN</td><td>length of array to print </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  {</div>
|
||||
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keywordtype">size_t</span> i;</div>
|
||||
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  </div>
|
||||
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="keywordflow">for</span> (i = 0; i < LEN; i++) {</div>
|
||||
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << arr[i] << <span class="stringliteral">", "</span>;</div>
|
||||
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  }</div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> {</div>
|
||||
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordtype">size_t</span> i;</div>
|
||||
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
|
||||
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keywordflow">for</span> (i = 0; i < LEN; i++) {</div>
|
||||
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << arr[i] << <span class="stringliteral">", "</span>;</div>
|
||||
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> }</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -346,7 +345,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a63aaff7cabfa3da2da8b9477b5fad9d6"></a>
|
||||
<a id="a63aaff7cabfa3da2da8b9477b5fad9d6" name="a63aaff7cabfa3da2da8b9477b5fad9d6"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a63aaff7cabfa3da2da8b9477b5fad9d6">◆ </a></span>show_data() <span class="overload">[2/2]</span></h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -363,16 +362,16 @@ template<typename T , size_t N> </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>pretty print array </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >pretty print array </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">arr</td><td>array to print </td></tr>
|
||||
<tr><td class="paramdir">[in]</td><td class="paramname">N</td><td>length of array to print </td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="fragment"><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  {</div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <a class="code" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(arr, N);</div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> {</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_function" href="../../d4/d7a/shell__sort2_8cpp.html#a951127aea9d7e1e53ea9ae0868633246">show_data</a>(arr, N);</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -382,7 +381,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a22ea0d1f7943ebb4371d31e44b465b6d"></a>
|
||||
<a id="a22ea0d1f7943ebb4371d31e44b465b6d" name="a22ea0d1f7943ebb4371d31e44b465b6d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a22ea0d1f7943ebb4371d31e44b465b6d">◆ </a></span>test_f()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -397,43 +396,43 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Test implementation of shell_sort on float arrays by comparing results against <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  {</div>
|
||||
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">float</span> *<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">float</span>[NUM_DATA];</div>
|
||||
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordtype">float</span> *data2 = <span class="keyword">new</span> <span class="keywordtype">float</span>[NUM_DATA];</div>
|
||||
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordtype">int</span> range = 1000;</div>
|
||||
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  </div>
|
||||
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = data2[i] = ((<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1)) / 100.;</div>
|
||||
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  }</div>
|
||||
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  </div>
|
||||
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="comment">/* sort using our implementation */</span></div>
|
||||
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <a class="code" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">double</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Time spent sorting using shell_sort2: "</span> << elapsed_time</div>
|
||||
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  </div>
|
||||
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="comment">/* sort using std::qsort */</span></div>
|
||||
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  start = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>(data2, NUM_DATA, <span class="keyword">sizeof</span>(data2[0]), <a class="code" href="../../d1/db3/structcompare.html">compare<float></a>);</div>
|
||||
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  </div>
|
||||
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Time spent sorting using std::qsort: "</span> << elapsed_time</div>
|
||||
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  </div>
|
||||
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  assert(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] == data2[i]); <span class="comment">// ensure that our sorting results match</span></div>
|
||||
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="comment">// the standard results</span></div>
|
||||
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  }</div>
|
||||
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  </div>
|
||||
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keyword">delete</span>[] <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keyword">delete</span>[] data2;</div>
|
||||
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span> }</div>
|
||||
<p >Test implementation of shell_sort on float arrays by comparing results against <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> {</div>
|
||||
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordtype">float</span> *<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">float</span>[NUM_DATA];</div>
|
||||
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordtype">float</span> *data2 = <span class="keyword">new</span> <span class="keywordtype">float</span>[NUM_DATA];</div>
|
||||
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordtype">int</span> range = 1000;</div>
|
||||
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> </div>
|
||||
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = data2[i] = ((<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1)) / 100.;</div>
|
||||
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> }</div>
|
||||
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div>
|
||||
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="comment">/* sort using our implementation */</span></div>
|
||||
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <a class="code hl_function" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="keywordtype">double</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</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">"Time spent sorting using shell_sort2: "</span> << elapsed_time</div>
|
||||
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
|
||||
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <span class="comment">/* sort using std::qsort */</span></div>
|
||||
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> start = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>(data2, NUM_DATA, <span class="keyword">sizeof</span>(data2[0]), <a class="code hl_struct" href="../../d1/db3/structcompare.html">compare<float></a>);</div>
|
||||
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
|
||||
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</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">"Time spent sorting using std::qsort: "</span> << elapsed_time</div>
|
||||
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> </div>
|
||||
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> assert(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] == data2[i]); <span class="comment">// ensure that our sorting results match</span></div>
|
||||
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="comment">// the standard results</span></div>
|
||||
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> }</div>
|
||||
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> </div>
|
||||
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <span class="keyword">delete</span>[] <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="keyword">delete</span>[] data2;</div>
|
||||
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span>}</div>
|
||||
<div class="ttc" id="aqsort_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a></div><div class="ttdeci">T qsort(T... args)</div></div>
|
||||
<div class="ttc" id="astructcompare_html"><div class="ttname"><a href="../../d1/db3/structcompare.html">compare</a></div><div class="ttdef"><b>Definition:</b> huffman.cpp:28</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
@@ -445,7 +444,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a895b313cb2671e8f712040460325573e"></a>
|
||||
<a id="a895b313cb2671e8f712040460325573e" name="a895b313cb2671e8f712040460325573e"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a895b313cb2671e8f712040460325573e">◆ </a></span>test_int()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -460,42 +459,42 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Test implementation of shell_sort on integer arrays by comparing results against <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  {</div>
|
||||
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">int</span> *<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordtype">int</span> *data2 = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordtype">int</span> range = 1800;</div>
|
||||
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  </div>
|
||||
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++)</div>
|
||||
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = data2[i] = (<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1);</div>
|
||||
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  </div>
|
||||
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="comment">/* sort using our implementation */</span></div>
|
||||
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordtype">double</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Time spent sorting using shell_sort2: "</span> << elapsed_time</div>
|
||||
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  </div>
|
||||
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="comment">/* sort using std::qsort */</span></div>
|
||||
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  start = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>(data2, NUM_DATA, <span class="keyword">sizeof</span>(data2[0]), <a class="code" href="../../d1/db3/structcompare.html">compare<int></a>);</div>
|
||||
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  </div>
|
||||
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Time spent sorting using std::qsort: "</span> << elapsed_time</div>
|
||||
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  </div>
|
||||
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  assert(<a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] == data2[i]); <span class="comment">// ensure that our sorting results match</span></div>
|
||||
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="comment">// the standard results</span></div>
|
||||
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</div>
|
||||
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  </div>
|
||||
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="keyword">delete</span>[] <a class="code" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keyword">delete</span>[] data2;</div>
|
||||
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> }</div>
|
||||
<p >Test implementation of shell_sort on integer arrays by comparing results against <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> {</div>
|
||||
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="comment">// int array = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">int</span> *<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a> = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordtype">int</span> *data2 = <span class="keyword">new</span> <span class="keywordtype">int</span>[NUM_DATA];</div>
|
||||
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="comment">// int array2 = new int[NUM_DATA];</span></div>
|
||||
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordtype">int</span> range = 1800;</div>
|
||||
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> </div>
|
||||
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++)</div>
|
||||
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] = data2[i] = (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % range) - (range >> 1);</div>
|
||||
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
|
||||
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="comment">/* sort using our implementation */</span></div>
|
||||
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> start = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <a class="code hl_function" href="../../d5/d91/namespacesorting.html#af2c5b92cbfe73f63f6074c61b0a45331">shell_sort</a>(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>, NUM_DATA);</div>
|
||||
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock_t.html">std::clock_t</a> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordtype">double</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</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">"Time spent sorting using shell_sort2: "</span> << elapsed_time</div>
|
||||
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
|
||||
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="comment">/* sort using std::qsort */</span></div>
|
||||
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> start = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/qsort.html">std::qsort</a>(data2, NUM_DATA, <span class="keyword">sizeof</span>(data2[0]), <a class="code hl_struct" href="../../d1/db3/structcompare.html">compare<int></a>);</div>
|
||||
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/chrono/c/clock.html">std::clock</a>();</div>
|
||||
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> </div>
|
||||
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> elapsed_time = <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">end</a> - start) / CLOCKS_PER_SEC;</div>
|
||||
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</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">"Time spent sorting using std::qsort: "</span> << elapsed_time</div>
|
||||
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> << <span class="stringliteral">"s\n"</span>;</div>
|
||||
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
|
||||
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < NUM_DATA; i++) {</div>
|
||||
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> assert(<a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>[i] == data2[i]); <span class="comment">// ensure that our sorting results match</span></div>
|
||||
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="comment">// the standard results</span></div>
|
||||
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div>
|
||||
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
|
||||
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keyword">delete</span>[] <a class="code hl_variable" href="../../d1/df3/hash__search_8cpp.html#a6e1a77282bc65ad359d753d25df23243">data</a>;</div>
|
||||
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keyword">delete</span>[] data2;</div>
|
||||
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -511,7 +510,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_bb1b521853a9c46347182a9d10420771.html">sorting</a></li><li class="navelem"><a class="el" href="../../d4/d7a/shell__sort2_8cpp.html">shell_sort2.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: main Pages: 1 -->
|
||||
<svg width="409pt" height="298pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test_f Pages: 1 -->
|
||||
<svg width="311pt" height="180pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: show_data Pages: 1 -->
|
||||
<svg width="264pt" height="28pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test_int Pages: 1 -->
|
||||
<svg width="319pt" height="180pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: show_data Pages: 1 -->
|
||||
<svg width="163pt" height="28pt"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -2,8 +2,8 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.9.1"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/sum_of_digits.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
@@ -17,9 +17,9 @@
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
@@ -32,8 +32,7 @@
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">Algorithms_in_C++
|
||||
 <span id="projectnumber">1.0.0</span>
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
</td>
|
||||
@@ -42,21 +41,22 @@
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.1 -->
|
||||
<!-- Generated by Doxygen 1.9.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="../../menudata.js"></script>
|
||||
<script type="text/javascript" src="../../menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
@@ -70,7 +70,7 @@ $(function() {
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('d4/d83/sum__of__digits_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -92,8 +92,7 @@ $(document).ready(function(){initNavTree('d4/d83/sum__of__digits_8cpp.html','../
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">sum_of_digits.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">sum_of_digits.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
@@ -108,7 +107,7 @@ Include dependency graph for sum_of_digits.cpp:</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a4619c78b6ad985713024f930f31c4395"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a> (int num)</td></tr>
|
||||
<tr class="separator:a4619c78b6ad985713024f930f31c4395"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
@@ -122,10 +121,10 @@ 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>A C++ Program to find the Sum of Digits of input integer. </p>
|
||||
<p>Copyright 2020 </p><dl class="section author"><dt>Author</dt><dd>iamnambiar </dd></dl>
|
||||
<div class="textblock"><p >A C++ Program to find the Sum of Digits of input integer. </p>
|
||||
<p >Copyright 2020 </p><dl class="section author"><dt>Author</dt><dd>iamnambiar </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -140,12 +139,12 @@ Functions</h2></td></tr>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main Function </p>
|
||||
<div class="fragment"><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  {</div>
|
||||
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <a class="code" href="../../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
|
||||
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Success."</span> << <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> }</div>
|
||||
<p >Main Function </p>
|
||||
<div class="fragment"><div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> {</div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_function" href="../../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a>();</div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</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">"Success."</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>}</div>
|
||||
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="asum__of__digits_8cpp_html_ae1a3968e7947464bee7714f6d43b7002"><div class="ttname"><a href="../../d4/d83/sum__of__digits_8cpp.html#ae1a3968e7947464bee7714f6d43b7002">test</a></div><div class="ttdeci">void test()</div><div class="ttdef"><b>Definition:</b> sum_of_digits.cpp:58</div></div>
|
||||
@@ -158,7 +157,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a4619c78b6ad985713024f930f31c4395"></a>
|
||||
<a id="a4619c78b6ad985713024f930f31c4395" name="a4619c78b6ad985713024f930f31c4395"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a4619c78b6ad985713024f930f31c4395">◆ </a></span>sum_of_digits()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -173,7 +172,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function to find the sum of the digits of an integer. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<p >Function to find the sum of the digits of an integer. </p><dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">num</td><td>The integer. </td></tr>
|
||||
</table>
|
||||
@@ -181,19 +180,19 @@ Here is the call graph for this function:</div>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>Sum of the digits of the integer.</dd></dl>
|
||||
<p>\detail First the algorithm check whether the num is negative or positive, if it is negative, then we neglect the negative sign. Next, the algorithm extract the last digit of num by dividing by 10 and extracting the remainder and this is added to the sum. The number is then divided by 10 to remove the last digit. This loop continues until num becomes 0. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  {</div>
|
||||
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="comment">// If num is negative then negative sign is neglected.</span></div>
|
||||
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">if</span> (num < 0) {</div>
|
||||
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  num = -1 * num;</div>
|
||||
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  }</div>
|
||||
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordtype">int</span> <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> = 0;</div>
|
||||
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordflow">while</span> (num > 0) {</div>
|
||||
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> = <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a> + (num % 10);</div>
|
||||
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  num = num / 10;</div>
|
||||
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  }</div>
|
||||
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">return</span> <a class="code" href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">sum</a>;</div>
|
||||
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> }</div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a5305cc18d11943d3dc0d66e70d7e9c44"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T >> &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
<div class="fragment"><div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> {</div>
|
||||
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="comment">// If num is negative then negative sign is neglected.</span></div>
|
||||
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">if</span> (num < 0) {</div>
|
||||
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> num = -1 * num;</div>
|
||||
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> }</div>
|
||||
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="keywordtype">int</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> = 0;</div>
|
||||
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordflow">while</span> (num > 0) {</div>
|
||||
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> = <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> + (num % 10);</div>
|
||||
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> num = num / 10;</div>
|
||||
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> }</div>
|
||||
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">return</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a>;</div>
|
||||
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a6f1c98c016ad34ff3d9f39372161bd35"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T > > &A)</div><div class="ttdef"><b>Definition:</b> vector_ops.hpp:232</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -203,7 +202,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae1a3968e7947464bee7714f6d43b7002"></a>
|
||||
<a id="ae1a3968e7947464bee7714f6d43b7002" name="ae1a3968e7947464bee7714f6d43b7002"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae1a3968e7947464bee7714f6d43b7002">◆ </a></span>test()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -217,13 +216,13 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> with all the test cases. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  {</div>
|
||||
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="comment">// First test.</span></div>
|
||||
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <a class="code" href="../../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a>();</div>
|
||||
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">// Second test.</span></div>
|
||||
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="code" href="../../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0">test2</a>();</div>
|
||||
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> }</div>
|
||||
<p >Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> with all the test cases. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> {</div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment">// First test.</span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <a class="code hl_function" href="../../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a>();</div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// Second test.</span></div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_function" href="../../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0">test2</a>();</div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span>}</div>
|
||||
<div class="ttc" id="asum__of__digits_8cpp_html_a0283886819c7c140a023582b7269e2d0"><div class="ttname"><a href="../../d4/d83/sum__of__digits_8cpp.html#a0283886819c7c140a023582b7269e2d0">test2</a></div><div class="ttdeci">void test2()</div><div class="ttdef"><b>Definition:</b> sum_of_digits.cpp:49</div></div>
|
||||
<div class="ttc" id="asum__of__digits_8cpp_html_a1440a7779ac56f47a3f355ce4a8c7da0"><div class="ttname"><a href="../../d4/d83/sum__of__digits_8cpp.html#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a></div><div class="ttdeci">void test1()</div><div class="ttdef"><b>Definition:</b> sum_of_digits.cpp:40</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
@@ -235,7 +234,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a1440a7779ac56f47a3f355ce4a8c7da0"></a>
|
||||
<a id="a1440a7779ac56f47a3f355ce4a8c7da0" name="a1440a7779ac56f47a3f355ce4a8c7da0"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a1440a7779ac56f47a3f355ce4a8c7da0">◆ </a></span>test1()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -249,11 +248,11 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> function with a first test case of 119765 and assert statement. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  {</div>
|
||||
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordtype">int</span> test_case_1 = <a class="code" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a>(119765);</div>
|
||||
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  assert(test_case_1 == 29);</div>
|
||||
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> }</div>
|
||||
<p >Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> function with a first test case of 119765 and assert statement. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> {</div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordtype">int</span> test_case_1 = <a class="code hl_function" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a>(119765);</div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> assert(test_case_1 == 29);</div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span>}</div>
|
||||
<div class="ttc" id="asum__of__digits_8cpp_html_a4619c78b6ad985713024f930f31c4395"><div class="ttname"><a href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a></div><div class="ttdeci">int sum_of_digits(int num)</div><div class="ttdef"><b>Definition:</b> sum_of_digits.cpp:23</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -264,7 +263,7 @@ Here is the call graph for this function:</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a0283886819c7c140a023582b7269e2d0"></a>
|
||||
<a id="a0283886819c7c140a023582b7269e2d0" name="a0283886819c7c140a023582b7269e2d0"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0283886819c7c140a023582b7269e2d0">◆ </a></span>test2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -278,11 +277,11 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> function with a second test case of -12256 and assert statement. </p>
|
||||
<div class="fragment"><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  {</div>
|
||||
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">int</span> test_case_2 = <a class="code" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a>(-12256);</div>
|
||||
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  assert(test_case_2 == 16);</div>
|
||||
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div>
|
||||
<p >Function for testing the <a class="el" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits()</a> function with a second test case of -12256 and assert statement. </p>
|
||||
<div class="fragment"><div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> {</div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordtype">int</span> test_case_2 = <a class="code hl_function" href="../../d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395">sum_of_digits</a>(-12256);</div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> assert(test_case_2 == 16);</div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span>}</div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -298,7 +297,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="../../d4/d83/sum__of__digits_8cpp.html">sum_of_digits.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.1 </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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<map id="test2" name="test2">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,5,56,32"/>
|
||||
<area shape="rect" id="node2" href="$d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395" title=" " alt="" coords="104,5,208,32"/>
|
||||
<area shape="rect" id="node3" href="$d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" title=" " alt="" coords="256,5,416,32"/>
|
||||
<area shape="rect" id="node3" href="$d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" title=" " alt="" coords="256,5,416,32"/>
|
||||
</map>
|
||||
|
||||
@@ -1 +1 @@
|
||||
fe84adc1328d400082a06b4d6b5752cf
|
||||
11f2613d8640e598fc4ace10b35036de
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.48.0 (20210717.1556)
|
||||
<!-- Generated by graphviz version 2.49.0 (20210828.1703)
|
||||
-->
|
||||
<!-- Title: test2 Pages: 1 -->
|
||||
<svg width="316pt" height="28pt"
|
||||
@@ -36,7 +36,7 @@
|
||||
<!-- Node3 -->
|
||||
<g id="node3" class="node">
|
||||
<title>Node3</title>
|
||||
<g id="a_node3"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" target="_top" xlink:title=" ">
|
||||
<g id="a_node3"><a xlink:href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" target="_top" xlink:title=" ">
|
||||
<polygon fill="white" stroke="black" points="188,-0.5 188,-19.5 308,-19.5 308,-0.5 188,-0.5"/>
|
||||
<text text-anchor="middle" x="248" y="-7.5" font-family="Helvetica,sans-Serif" font-size="10.00">machine_learning::sum</text>
|
||||
</a>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -1,5 +1,5 @@
|
||||
<map id="test1" name="test1">
|
||||
<area shape="rect" id="node1" title=" " alt="" coords="5,5,56,32"/>
|
||||
<area shape="rect" id="node2" href="$d4/d83/sum__of__digits_8cpp.html#a4619c78b6ad985713024f930f31c4395" title=" " alt="" coords="104,5,208,32"/>
|
||||
<area shape="rect" id="node3" href="$d8/d77/namespacemachine__learning.html#a5305cc18d11943d3dc0d66e70d7e9c44" title=" " alt="" coords="256,5,416,32"/>
|
||||
<area shape="rect" id="node3" href="$d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35" title=" " alt="" coords="256,5,416,32"/>
|
||||
</map>
|
||||
|
||||