Documentation for f1eddf4d65

This commit is contained in:
realstealthninja
2025-07-09 10:53:16 +00:00
parent e7edde96ab
commit b41207008f
2497 changed files with 31270 additions and 40283 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: sorting/bubble_sort.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -19,7 +19,6 @@
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
@@ -60,26 +59,20 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.13.2 -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
$(function() { codefold.init(); });
</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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
@@ -94,10 +87,9 @@ $(function() {
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('d8/d13/bubble__sort_8cpp.html','../../'); initResizable(true); });
/* @license-end */
$(function(){initNavTree('d8/d13/bubble__sort_8cpp.html','../../',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
@@ -121,9 +113,6 @@ $(function(){initNavTree('d8/d13/bubble__sort_8cpp.html','../../'); initResizabl
</div>
<div class="header">
<div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">bubble_sort.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
@@ -139,34 +128,29 @@ $(function(){initNavTree('d8/d13/bubble__sort_8cpp.html','../../'); initResizabl
</div><div class="textblock"><div class="dynheader">
Include dependency graph for bubble_sort.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d6/d1d/bubble__sort_8cpp__incl.svg" width="504" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="../../d6/d1d/bubble__sort_8cpp__incl.svg" width="504" height="111"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
<p><a href="../../d8/d13/bubble__sort_8cpp_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 id="namespaces" name="namespaces"></a>
<tr class="heading"><td colspan="2"><h2 id="header-namespaces" class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:"><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="memitem:sorting" id="r_sorting"><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">for working with vectors <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dd5/namespacebubble__sort.html">bubble_sort</a></td></tr>
<tr class="memitem:bubble_5Fsort" id="r_bubble_5Fsort"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/dd5/namespacebubble__sort.html">bubble_sort</a></td></tr>
<tr class="memdesc:d0/dd5/namespacebubble__sort"><td class="mdescLeft">&#160;</td><td class="mdescRight">Bubble sort algorithm. <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 id="func-members" name="func-members"></a>
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:af3b12930a83915712461d53fe9659686" id="r_af3b12930a83915712461d53fe9659686"><td class="memTemplParams" colspan="2">template&lt;typename T&gt; </td></tr>
<tr class="memitem:af3b12930a83915712461d53fe9659686"><td class="memTemplItemLeft" align="right" valign="top">std::vector&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#af3b12930a83915712461d53fe9659686">sorting::bubble_sort::bubble_sort</a> (std::vector&lt; T &gt; &amp;array)</td></tr>
<tr class="memitem:af3b12930a83915712461d53fe9659686 template"><td class="memItemLeft" align="right" valign="top">std::vector&lt; T &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af3b12930a83915712461d53fe9659686">sorting::bubble_sort::bubble_sort</a> (std::vector&lt; T &gt; &amp;array)</td></tr>
<tr class="memdesc:af3b12930a83915712461d53fe9659686"><td class="mdescLeft">&#160;</td><td class="mdescRight">Bubble sort algorithm. <br /></td></tr>
<tr class="separator:af3b12930a83915712461d53fe9659686"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementation. <br /></td></tr>
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" id="r_ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></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>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Bubble sort algorithm. </p>
<p>Bubble sort algorithm is the bubble sorting algorithm. The most important reason for calling the bubble is that the largest number is thrown at the end of this algorithm. This is all about the logic. In each iteration, the largest number is expired and when iterations are completed, the sorting takes place.</p>
<p>What is Swap?</p>
@@ -176,15 +160,15 @@ Functions</h2></td></tr>
<div class="line">x = y;</div>
<div class="line">y = z;</div>
</div><!-- fragment --><p>The above process is a typical displacement process. When x assigns the value to x, the old value of x is lost. That's why we created a variable z to create the first value of the value of x, and finally, we have assigned to y.</p>
<h2><a class="anchor" id="autotoc_md111"></a>
<h2 class="doxsection"><a class="anchor" id="autotoc_md111"></a>
Bubble Sort Algorithm Analysis (Best Case - Worst Case - Average Case)</h2>
<h3><a class="anchor" id="autotoc_md112"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md112"></a>
Best Case</h3>
<p>Bubble Sort Best Case Performance. \(O(n)\). However, you can't get the best status in the code we shared above. This happens on the optimized bubble sort algorithm. It's right down there.</p>
<h3><a class="anchor" id="autotoc_md113"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md113"></a>
Worst Case</h3>
<p>Bubble Sort Worst Case Performance is \(O(n^{2})\). Why is that? Because if you remember Big O Notation, we were calculating the complexity of the algorithms in the nested loops. The \(n * (n - 1)\) product gives us \(O(n^{2})\) performance. In the worst case all the steps of the cycle will occur.</p>
<h3><a class="anchor" id="autotoc_md114"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md114"></a>
Average Case</h3>
<p>Bubble Sort is not an optimal algorithm. In average, \(O(n^{2})\) performance is taken.</p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Deepak-j-p" target="_blank">Deepak</a> </dd>
@@ -192,7 +176,7 @@ Average Case</h3>
<a href="https://github.com/hollowcrust" target="_blank">Nguyen Phuc Chuong</a> </dd></dl>
<p class="definition">Definition in file <a class="el" href="../../d8/d13/bubble__sort_8cpp_source.html">bubble_sort.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
<a id="af3b12930a83915712461d53fe9659686" name="af3b12930a83915712461d53fe9659686"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af3b12930a83915712461d53fe9659686">&#9670;&#160;</a></span>bubble_sort()</h2>
@@ -277,7 +261,7 @@ template&lt;typename T&gt; </div>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void test </td>
<td class="memname">void test </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
@@ -330,11 +314,19 @@ template&lt;typename T&gt; </div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<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="../../d8/d13/bubble__sort_8cpp.html">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.13.2 </li>
<li class="navelem"><a href="../../dir_bb1b521853a9c46347182a9d10420771.html">sorting</a></li><li class="navelem"><a href="../../d8/d13/bubble__sort_8cpp.html">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.14.0 </li>
</ul>
</div>
</body>