Documentation for 0931d530ae

This commit is contained in:
github-actions
2023-01-22 19:44:10 +00:00
parent a448f64699
commit b48f6e8671
2457 changed files with 9513 additions and 8691 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: sorting/insertion_sort.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -127,14 +127,14 @@ Namespaces</h2></td></tr>
Functions</h2></td></tr>
<tr class="memitem:a78cb2f3b97b6db2c062b2a1df05c9ea9"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a78cb2f3b97b6db2c062b2a1df05c9ea9"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d5/d91/namespacesorting.html#a78cb2f3b97b6db2c062b2a1df05c9ea9">sorting::insertionSort</a> (T *arr, int n)</td></tr>
<tr class="memdesc:a78cb2f3b97b6db2c062b2a1df05c9ea9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insertion Sort Function. <a href="../../d5/d91/namespacesorting.html#a78cb2f3b97b6db2c062b2a1df05c9ea9">More...</a><br /></td></tr>
<tr class="memdesc:a78cb2f3b97b6db2c062b2a1df05c9ea9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insertion Sort Function. <br /></td></tr>
<tr class="separator:a78cb2f3b97b6db2c062b2a1df05c9ea9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8fe6bac9e03f58abcc2ce26ef3de1b5f"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a8fe6bac9e03f58abcc2ce26ef3de1b5f"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../d5/d91/namespacesorting.html#a8fe6bac9e03f58abcc2ce26ef3de1b5f">sorting::insertionSort</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; T &gt; *arr)</td></tr>
<tr class="separator:a8fe6bac9e03f58abcc2ce26ef3de1b5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59914553f24088342c139645a02a8a49"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a59914553f24088342c139645a02a8a49"><td class="memTemplItemLeft" align="right" valign="top">static void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../dd/d0d/insertion__sort_8cpp.html#a59914553f24088342c139645a02a8a49">create_random_array</a> (T *arr, int N)</td></tr>
<tr class="memdesc:a59914553f24088342c139645a02a8a49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a random array objecthelper function to create a random array. <a href="../../dd/d0d/insertion__sort_8cpp.html#a59914553f24088342c139645a02a8a49">More...</a><br /></td></tr>
<tr class="memdesc:a59914553f24088342c139645a02a8a49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a random array objecthelper function to create a random array. <br /></td></tr>
<tr class="separator:a59914553f24088342c139645a02a8a49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a88ec9ad42717780d6caaff9d3d6977f9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d0d/insertion__sort_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a> ()</td></tr>
<tr class="separator:a88ec9ad42717780d6caaff9d3d6977f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -142,16 +142,16 @@ 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 ><a href="https://en.wikipedia.org/wiki/Insertion_sort" target="_blank">Insertion Sort Algorithm (Insertion Sort)</a> </p>
<p >Insertion sort is a simple sorting algorithm that builds the final sorted array one at a time. It is much less efficient compared to other sorting algorithms like heap sort, merge sort or quick sort. However it has several advantages such as</p><ol type="1">
<div class="textblock"><p><a href="https://en.wikipedia.org/wiki/Insertion_sort" target="_blank">Insertion Sort Algorithm (Insertion Sort)</a> </p>
<p>Insertion sort is a simple sorting algorithm that builds the final sorted array one at a time. It is much less efficient compared to other sorting algorithms like heap sort, merge sort or quick sort. However it has several advantages such as</p><ol type="1">
<li>Easy to implement</li>
<li>For small set of data it is quite efficient</li>
<li>More efficient that other Quadratic complexity algorithms like Selection sort or bubble sort.</li>
<li>It's stable that is it does not change the relative order of elements with equal keys</li>
<li>Works on hand means it can sort the array or list as it receives.</li>
</ol>
<p >It is based on the same idea that people use to sort the playing cards in their hands. the algorithms goes in the manner that we start iterating over the array of elements as soon as we find a unsorted element that is a misplaced element we place it at a sorted position.</p>
<p >Example execution steps:</p><ol type="1">
<p>It is based on the same idea that people use to sort the playing cards in their hands. the algorithms goes in the manner that we start iterating over the array of elements as soon as we find a unsorted element that is a misplaced element we place it at a sorted position.</p>
<p>Example execution steps:</p><ol type="1">
<li>Suppose initially we have <p class="formulaDsp">
\begin{bmatrix}4 &amp;3 &amp;2 &amp;5 &amp;1\end{bmatrix}
</p>
@@ -252,9 +252,9 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >Main Function </p>
<p >Running predefined tests to test algorithm</p>
<p >For user insteraction</p>
<p>Main Function </p>
<p>Running predefined tests to test algorithm</p>
<p>For user insteraction</p>
<div class="fragment"><div class="line"><span class="lineno"> 150</span> {<span class="comment"></span></div>
<div class="line"><span class="lineno"> 151</span><span class="comment"> /// Running predefined tests to test algorithm</span></div>
<div class="line"><span class="lineno"> 152</span><span class="comment"></span> <a class="code hl_function" href="../../dd/d0d/insertion__sort_8cpp.html#a88ec9ad42717780d6caaff9d3d6977f9">tests</a>();</div>
@@ -313,7 +313,7 @@ Here is the call graph for this function:</div>
</tr>
</table>
</div><div class="memdoc">
<p >Test Cases to test algorithm </p>
<p>Test Cases to test algorithm </p>
<div class="fragment"><div class="line"><span class="lineno"> 109</span> {</div>
<div class="line"><span class="lineno"> 110</span> <span class="keywordtype">int</span> arr1[10] = {78, 34, 35, 6, 34, 56, 3, 56, 2, 4};</div>
<div class="line"><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;Test 1... &quot;</span>;</div>
@@ -373,7 +373,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="../../dd/d0d/insertion__sort_8cpp.html">insertion_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.5 </li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>