mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-21 20:31:43 +08:00
Documentation for 341ed50da8
This commit is contained in:
@@ -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++: data_structures/list_array.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('d7/d00/list__array_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -94,12 +94,11 @@ $(document).ready(function(){initNavTree('d7/d00/list__array_8cpp.html','../../'
|
||||
<a href="#nested-classes">Classes</a> |
|
||||
<a href="#namespaces">Namespaces</a> |
|
||||
<a href="#func-members">Functions</a> </div>
|
||||
<div class="headertitle">
|
||||
<div class="title">list_array.cpp File Reference</div> </div>
|
||||
<div class="headertitle"><div class="title">list_array.cpp File Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
|
||||
<p><a href="https://en.wikipedia.org/wiki/Dynamic_array">Dynamic Array</a>
|
||||
<p><a href="https://en.wikipedia.org/wiki/Dynamic_array" target="_blank">Dynamic Array</a>
|
||||
<a href="#details">More...</a></p>
|
||||
<div class="textblock"><code>#include <iostream></code><br />
|
||||
<code>#include <array></code><br />
|
||||
@@ -111,22 +110,22 @@ Include dependency graph for list_array.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">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html">data_structures::list_array::list</a></td></tr>
|
||||
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Structure of List with supporting methods. <a href="../../d5/dab/structdata__structures_1_1list__array_1_1list.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:d5/d3c/namespacedata__structures"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3c/namespacedata__structures.html">data_structures</a></td></tr>
|
||||
<tr class="memitem:d5/d3c/namespacedata__structures"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d5/d3c/namespacedata__structures.html">data_structures</a></td></tr>
|
||||
<tr class="memdesc:d5/d3c/namespacedata__structures"><td class="mdescLeft"> </td><td class="mdescRight">Data Structures algorithms. <br /></td></tr>
|
||||
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:d9/d27/namespacelist__array"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d27/namespacelist__array.html">list_array</a></td></tr>
|
||||
<tr class="memdesc:d9/d27/namespacelist__array"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Dynamic_array">Dynamic Array</a> algorithm. <br /></td></tr>
|
||||
<tr class="memitem:d9/d27/namespacelist__array"><td class="memItemLeft" align="right" valign="top">namespace  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/d27/namespacelist__array.html">list_array</a></td></tr>
|
||||
<tr class="memdesc:d9/d27/namespacelist__array"><td class="mdescLeft"> </td><td class="mdescRight">Functions for <a href="https://en.wikipedia.org/wiki/Dynamic_array" target="_blank">Dynamic Array</a> algorithm. <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:aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Test implementations. <a href="../../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">More...</a><br /></td></tr>
|
||||
@@ -136,13 +135,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/Dynamic_array">Dynamic Array</a> </p>
|
||||
<p>The <a class="el" href="../../d9/d27/namespacelist__array.html" title="Functions for Dynamic Array algorithm.">list_array</a> is the implementation of list represented using array. We can perform basic CRUD operations as well as other operations like sorting etc.</p>
|
||||
<div class="textblock"><p ><a href="https://en.wikipedia.org/wiki/Dynamic_array" target="_blank">Dynamic Array</a> </p>
|
||||
<p >The <a class="el" href="../../d9/d27/namespacelist__array.html" title="Functions for Dynamic Array algorithm.">list_array</a> is the implementation of list represented using array. We can perform basic CRUD operations as well as other operations like sorting etc.</p>
|
||||
<h3><a class="anchor" id="autotoc_md34"></a>
|
||||
Algorithm</h3>
|
||||
<p>It implements various method like insert, sort, search etc. efficiently. You can select the operation and methods will do the rest work for you. You can insert element, sort them in order, search efficiently, delete values and print the list. </p>
|
||||
<p >It implements various method like insert, sort, search etc. efficiently. You can select the operation and methods will do the rest work for you. You can insert element, sort them in order, search efficiently, delete values and print the list. </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">◆ </a></span>main()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
@@ -160,10 +159,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="l00247"></a><span class="lineno"> 247</span>  {</div>
|
||||
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <a class="code" href="../../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// Execute the tests</span></div>
|
||||
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>  <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span> }</div>
|
||||
<div class="fragment"><div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> {</div>
|
||||
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> <a class="code hl_function" href="../../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// Execute the tests</span></div>
|
||||
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span>}</div>
|
||||
<div class="ttc" id="alist__array_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d7/d00/list__array_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Test implementations.</div><div class="ttdef"><b>Definition:</b> list_array.cpp:205</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -174,7 +173,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">
|
||||
@@ -199,43 +198,43 @@ Here is the call graph for this function:</div>
|
||||
|
||||
<p>Test implementations. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
||||
<div class="fragment"><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>  <a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html">data_structures::list_array::list</a> L;</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">// Insert testing</span></div>
|
||||
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(11);</div>
|
||||
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(12);</div>
|
||||
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  assert(L.top == 2);</div>
|
||||
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(15);</div>
|
||||
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(10);</div>
|
||||
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(12);</div>
|
||||
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(20);</div>
|
||||
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(18);</div>
|
||||
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  assert(L.top == 7);</div>
|
||||
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#ae5c15d93819c4e437ebb7a1b41f2d594">show</a>(); <span class="comment">// To print the array</span></div>
|
||||
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  </div>
|
||||
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="comment">// Remove testing</span></div>
|
||||
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(12); <span class="comment">// Remove Duplicate value in the list</span></div>
|
||||
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(15); <span class="comment">// Remove the existing value in the list</span></div>
|
||||
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  assert(L.top == 5);</div>
|
||||
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(50); <span class="comment">// Try to remove the non-existing value in the list</span></div>
|
||||
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  assert(L.top == 5);</div>
|
||||
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  </div>
|
||||
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="comment">// LinearSearch testing</span></div>
|
||||
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  assert(L.search(11) == 0); <span class="comment">// search for the existing element</span></div>
|
||||
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  assert(L.search(12) == 2);</div>
|
||||
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  assert(L.search(50) == -1); <span class="comment">// search for the non-existing element</span></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="comment">// Sort testing</span></div>
|
||||
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a39a712c8413b0d7861695ec019474469">sort</a>();</div>
|
||||
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  assert(L.isSorted == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  L.<a class="code" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#ae5c15d93819c4e437ebb7a1b41f2d594">show</a>();</div>
|
||||
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  </div>
|
||||
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  <span class="comment">// BinarySearch testing</span></div>
|
||||
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  assert(L.search(11) == 1); <span class="comment">// search for the existing element</span></div>
|
||||
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  assert(L.search(12) == 2);</div>
|
||||
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  assert(L.search(50) == -1); <span class="comment">// search for the non-existing element</span></div>
|
||||
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span> }</div>
|
||||
<div class="fragment"><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> <a class="code hl_struct" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html">data_structures::list_array::list</a> L;</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">// Insert testing</span></div>
|
||||
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(11);</div>
|
||||
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(12);</div>
|
||||
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> assert(L.top == 2);</div>
|
||||
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(15);</div>
|
||||
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(10);</div>
|
||||
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(12);</div>
|
||||
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(20);</div>
|
||||
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">insert</a>(18);</div>
|
||||
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> assert(L.top == 7);</div>
|
||||
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#ae5c15d93819c4e437ebb7a1b41f2d594">show</a>(); <span class="comment">// To print the array</span></div>
|
||||
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> </div>
|
||||
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="comment">// Remove testing</span></div>
|
||||
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(12); <span class="comment">// Remove Duplicate value in the list</span></div>
|
||||
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(15); <span class="comment">// Remove the existing value in the list</span></div>
|
||||
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> assert(L.top == 5);</div>
|
||||
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">remove</a>(50); <span class="comment">// Try to remove the non-existing value in the list</span></div>
|
||||
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> assert(L.top == 5);</div>
|
||||
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> </div>
|
||||
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <span class="comment">// LinearSearch testing</span></div>
|
||||
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> assert(L.search(11) == 0); <span class="comment">// search for the existing element</span></div>
|
||||
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> assert(L.search(12) == 2);</div>
|
||||
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> assert(L.search(50) == -1); <span class="comment">// search for the non-existing element</span></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="comment">// Sort testing</span></div>
|
||||
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a39a712c8413b0d7861695ec019474469">sort</a>();</div>
|
||||
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> assert(L.isSorted == <span class="keyword">true</span>);</div>
|
||||
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> L.<a class="code hl_function" href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#ae5c15d93819c4e437ebb7a1b41f2d594">show</a>();</div>
|
||||
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> </div>
|
||||
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="comment">// BinarySearch testing</span></div>
|
||||
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> assert(L.search(11) == 1); <span class="comment">// search for the existing element</span></div>
|
||||
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> assert(L.search(12) == 2);</div>
|
||||
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> assert(L.search(50) == -1); <span class="comment">// search for the non-existing element</span></div>
|
||||
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span>}</div>
|
||||
<div class="ttc" id="astructdata__structures_1_1list__array_1_1list_html"><div class="ttname"><a href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html">data_structures::list_array::list</a></div><div class="ttdoc">Structure of List with supporting methods.</div><div class="ttdef"><b>Definition:</b> list_array.cpp:32</div></div>
|
||||
<div class="ttc" id="astructdata__structures_1_1list__array_1_1list_html_a0499455a80156134cc79c98eabb376d9"><div class="ttname"><a href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0499455a80156134cc79c98eabb376d9">data_structures::list_array::list::remove</a></div><div class="ttdeci">void remove(const uint64_t &val)</div><div class="ttdoc">To remove the element from the list.</div><div class="ttdef"><b>Definition:</b> list_array.cpp:171</div></div>
|
||||
<div class="ttc" id="astructdata__structures_1_1list__array_1_1list_html_a0f44d5e3a52d35f8ff23ace9569c6305"><div class="ttname"><a href="../../d5/dab/structdata__structures_1_1list__array_1_1list.html#a0f44d5e3a52d35f8ff23ace9569c6305">data_structures::list_array::list::insert</a></div><div class="ttdeci">void insert(const uint64_t &val)</div><div class="ttdoc">Insert the new element in the list.</div><div class="ttdef"><b>Definition:</b> list_array.cpp:132</div></div>
|
||||
@@ -256,7 +255,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_2e746e9d06bf2d8ff842208bcc6ebcfc.html">data_structures</a></li><li class="navelem"><a class="el" href="../../d7/d00/list__array_8cpp.html">list_array.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>
|
||||
|
||||
Reference in New Issue
Block a user