Documentation for 341ed50da8

This commit is contained in:
github-actions
2021-09-03 19:56:17 +00:00
parent 52d0c55145
commit 08e8eb037e
3432 changed files with 71392 additions and 72953 deletions

View File

@@ -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/recursive_bubble_sort.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++
&#160;<span id="projectnumber">1.0.0</span>
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;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&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;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&amp;dn=gpl-2.0.txt GPL-v2 */
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;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&amp;dn=gpl-2.0.txt GPL-v2 */
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('d3/df9/recursive__bubble__sort_8cpp.html','../../'); initResizable(); });
/* @license-end */
</script>
@@ -93,12 +93,11 @@ $(document).ready(function(){initNavTree('d3/df9/recursive__bubble__sort_8cpp.ht
<div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">recursive_bubble_sort.cpp File Reference</div> </div>
<div class="headertitle"><div class="title">recursive_bubble_sort.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>This is an implementation of a recursive version of the <a href="https://www.geeksforgeeks.org/recursive-bubble-sort/">Bubble sort algorithm</a>
<p>This is an implementation of a recursive version of the <a href="https://www.geeksforgeeks.org/recursive-bubble-sort/" target="_blank">Bubble sort algorithm</a>
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cassert&gt;</code><br />
<code>#include &lt;iostream&gt;</code><br />
@@ -112,13 +111,13 @@ Include dependency graph for recursive_bubble_sort.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"> &#160;</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 &#160;</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">&#160;</td><td class="mdescRight">Sorting algorithms. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</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:ae3a775d99dbbb94c130a973df0cfddcf"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ae3a775d99dbbb94c130a973df0cfddcf"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; T &gt; *nums, uint64_t n)</td></tr>
@@ -132,22 +131,22 @@ Functions</h2></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is an implementation of a recursive version of the <a href="https://www.geeksforgeeks.org/recursive-bubble-sort/">Bubble sort algorithm</a> </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://adityaprakash.tech">Aditya Prakash</a></dd></dl>
<div class="textblock"><p >This is an implementation of a recursive version of the <a href="https://www.geeksforgeeks.org/recursive-bubble-sort/" target="_blank">Bubble sort algorithm</a> </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://adityaprakash.tech" target="_blank">Aditya Prakash</a></dd></dl>
<p>The working principle of the Bubble sort algorithm.</p>
<p>Bubble sort is a simple sorting algorithm used to rearrange a set of ascending or descending order elements. Bubble sort gets its name from the fact that data "bubbles" to the top of the dataset.</p>
<p >Bubble sort is a simple sorting algorithm used to rearrange a set of ascending or descending order elements. Bubble sort gets its name from the fact that data "bubbles" to the top of the dataset.</p>
<h3><a class="anchor" id="autotoc_md96"></a>
Algorithm</h3>
<p>What is Swap?</p>
<p>Swapping two numbers means that we interchange their values. Often, an additional variable is required for this operation. This is further illustrated in the following:</p>
<p>void swap(int x, int y){ int z = x; x = y; y = z; }</p>
<p>The above process is a typical displacement process. When we assign a value to x, the old value of x is lost. That's why we create a temporary variable z to store the initial value of x. z is further used to assign the initial value of x to y, to complete swapping.</p>
<p>Recursion</p>
<p>While the recursive method does not necessarily have advantages over iterative versions, but it is useful to enhance the understanding of the algorithm and recursion itself. In Recursive Bubble sort algorithm, we firstly call the function on the entire array, and for every subsequent function call, we exclude the last element. This fixes the last element for that sub-array.Formally, for <code>ith</code> iteration, we consider elements up to n-i, where n is the number of elements in the array. Exit condition: n==1; i.e. the sub-array contains only one element.</p>
<p>Complexity Time complexity: O(n) best case; O(n²) average case; O(n²) worst case Space complexity: O(n)</p>
<p>We need to traverse the array <code>n * (n-1)</code> times. However, if the entire array is already sorted, then we need to traverse it only once. Hence, O(n) is the best case complexity </p>
<p >What is Swap?</p>
<p >Swapping two numbers means that we interchange their values. Often, an additional variable is required for this operation. This is further illustrated in the following:</p>
<p >void swap(int x, int y){ int z = x; x = y; y = z; }</p>
<p >The above process is a typical displacement process. When we assign a value to x, the old value of x is lost. That's why we create a temporary variable z to store the initial value of x. z is further used to assign the initial value of x to y, to complete swapping.</p>
<p >Recursion</p>
<p >While the recursive method does not necessarily have advantages over iterative versions, but it is useful to enhance the understanding of the algorithm and recursion itself. In Recursive Bubble sort algorithm, we firstly call the function on the entire array, and for every subsequent function call, we exclude the last element. This fixes the last element for that sub-array.Formally, for <code>ith</code> iteration, we consider elements up to n-i, where n is the number of elements in the array. Exit condition: n==1; i.e. the sub-array contains only one element.</p>
<p >Complexity Time complexity: O(n) best case; O(n²) average case; O(n²) worst case Space complexity: O(n)</p>
<p >We need to traverse the array <code>n * (n-1)</code> times. However, if the entire array is already sorted, then we need to traverse it only once. Hence, O(n) is the best case complexity </p>
</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">&#9670;&nbsp;</a></span>main()</h2>
<div class="memitem">
@@ -165,10 +164,10 @@ Algorithm</h3>
<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="l00146"></a><span class="lineno"> 146</span>&#160; { </div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <a class="code" href="../../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;}</div>
<div class="fragment"><div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> { </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <a class="code hl_function" href="../../d3/df9/recursive__bubble__sort_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>}</div>
<div class="ttc" id="arecursive__bubble__sort_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d3/df9/recursive__bubble__sort_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> recursive_bubble_sort.cpp:95</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -179,7 +178,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">&#9670;&nbsp;</a></span>test()</h2>
<div class="memitem">
@@ -204,52 +203,52 @@ 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="l00095"></a><span class="lineno"> 95</span>&#160; {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="comment">// 1st example. Creating an array of type `int`.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;1st test using `int`\n&quot;</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <span class="keyword">const</span> uint64_t size = 6;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> arr;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="comment">// populating the array</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(22);</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(46);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(94);</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(12);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(37);</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(63);</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// array populating ends</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <a class="code" href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a>(&amp;arr, size);</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; assert(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr), <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr)));</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; 1st test passed!\n&quot;</span>;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="comment">// printing the array</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordflow">for</span> (uint64_t i = 0; i &lt; size; i++) {</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; arr[i] &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; }</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <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="l00117"></a><span class="lineno"> 117</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="comment">// 2nd example. Creating an array of type `double`.</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;2nd test using doubles\n&quot;</span>;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;double&gt;</a> double_arr;</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="comment">// populating the array</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(20.4);</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(62.7);</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(12.2);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(43.6);</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(74.1);</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; double_arr.<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(57.9);</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="comment">// array populating ends</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; </div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <a class="code" href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a>(&amp;double_arr, size);</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; assert(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(double_arr), <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(double_arr)));</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; 2nd test passed!\n&quot;</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="comment">// printing the array</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">for</span> (uint64_t i = 0; i &lt; size; i++) {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; double_arr[i] &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; }</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <a class="codeRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <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="l00139"></a><span class="lineno"> 139</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;}</div>
<div class="fragment"><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">// 1st example. Creating an array of type `int`.</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;1st test using `int`\n&quot;</span>;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keyword">const</span> uint64_t size = 6;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> arr;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="comment">// populating the array</span></div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(22);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(46);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(94);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(12);</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(37);</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(63);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="comment">// array populating ends</span></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> </div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_function" href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a>(&amp;arr, size);</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(arr), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(arr)));</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::cout</a> &lt;&lt; <span class="stringliteral">&quot; 1st test passed!\n&quot;</span>;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="comment">// printing the array</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">for</span> (uint64_t i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; arr[i] &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>;</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</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/io/basic_ostream.html">std::cout</a> &lt;&lt; <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="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="comment">// 2nd example. Creating an array of type `double`.</span></div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;2nd test using doubles\n&quot;</span>;</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/vector.html">std::vector&lt;double&gt;</a> double_arr;</div>
<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="comment">// populating the array</span></div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(20.4);</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(62.7);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(12.2);</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(43.6);</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(74.1);</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> double_arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(57.9);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="comment">// array populating ends</span></div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> </div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <a class="code hl_function" href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a>(&amp;double_arr, size);</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> assert(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a>(double_arr), <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a>(double_arr)));</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot; 2nd test passed!\n&quot;</span>;</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="comment">// printing the array</span></div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordflow">for</span> (uint64_t i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; double_arr[i] &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>;</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> }</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <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="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="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="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/begin.html">std::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/end.html">std::end</a></div><div class="ttdeci">T end(T... args)</div></div>
@@ -257,7 +256,7 @@ Here is the call graph for this function:</div>
<div class="ttc" id="ais_sorted_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a></div><div class="ttdeci">T is_sorted(T... args)</div></div>
<div class="ttc" id="anamespacesorting_html_ae3a775d99dbbb94c130a973df0cfddcf"><div class="ttname"><a href="../../d5/d91/namespacesorting.html#ae3a775d99dbbb94c130a973df0cfddcf">sorting::recursive_bubble_sort</a></div><div class="ttdeci">void recursive_bubble_sort(std::vector&lt; T &gt; *nums, uint64_t n)</div><div class="ttdoc">This is an implementation of the recursive_bubble_sort. A vector is passed to the function which is t...</div><div class="ttdef"><b>Definition:</b> recursive_bubble_sort.cpp:74</div></div>
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt; int64_t &gt;</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>
</div>
@@ -267,7 +266,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="../../d3/df9/recursive__bubble__sort_8cpp.html">recursive_bubble_sort.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>