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++: others/recursive_tree_traversal.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('dc/de1/recursive__tree__traversal_8cpp.html','../../'); initResizable(true); });
/* @license-end */
$(function(){initNavTree('dc/de1/recursive__tree__traversal_8cpp.html','../../',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
@@ -121,10 +113,6 @@ $(function(){initNavTree('dc/de1/recursive__tree__traversal_8cpp.html','../../')
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">recursive_tree_traversal.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
@@ -138,62 +126,52 @@ $(function(){initNavTree('dc/de1/recursive__tree__traversal_8cpp.html','../../')
</div><div class="textblock"><div class="dynheader">
Include dependency graph for recursive_tree_traversal.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../dd/dae/recursive__tree__traversal_8cpp__incl.svg" width="336" height="126"><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="../../dd/dae/recursive__tree__traversal_8cpp__incl.svg" width="336" height="126"><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="../../dc/de1/recursive__tree__traversal_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="nested-classes" name="nested-classes"></a>
<tr class="heading"><td colspan="2"><h2 id="header-nested-classes" 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 &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/df7/structothers_1_1recursive__tree__traversals_1_1_node.html">others::recursive_tree_traversals::Node</a></td></tr>
<tr class="memitem:others_3A_3Arecursive_5Ftree_5Ftraversals_3A_3ANode" id="r_others_3A_3Arecursive_5Ftree_5Ftraversals_3A_3ANode"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d9/df7/structothers_1_1recursive__tree__traversals_1_1_node.html">others::recursive_tree_traversals::Node</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure to hold Nodes of the tree. <a href="../../d9/df7/structothers_1_1recursive__tree__traversals_1_1_node.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html">others::recursive_tree_traversals::BT</a></td></tr>
<tr class="memitem:others_3A_3Arecursive_5Ftree_5Ftraversals_3A_3ABT" id="r_others_3A_3Arecursive_5Ftree_5Ftraversals_3A_3ABT"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html">others::recursive_tree_traversals::BT</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="../../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html" title="BT used to make the entire structure of the binary tree and the functions associated with the binary ...">BT</a> used to make the entire structure of the binary tree and the functions associated with the binary tree. <a href="../../dd/de1/classothers_1_1recursive__tree__traversals_1_1_b_t.html#details">More...</a><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="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="../../d0/d6f/namespaceothers.html">others</a></td></tr>
<tr class="memdesc:d0/d6f/namespaceothers"><td class="mdescLeft">&#160;</td><td class="mdescRight">for <code>vector</code> <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="../../d1/d64/namespaceinterpolation__search.html">interpolation_search</a></td></tr>
<tr class="memitem:others" id="r_others"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/d6f/namespaceothers.html">others</a></td></tr>
<tr class="memdesc:d0/d6f/namespaceothers"><td class="mdescLeft">&#160;</td><td class="mdescRight">for <span class="tt">vector</span> <br /></td></tr>
<tr class="memitem:interpolation_5Fsearch" id="r_interpolation_5Fsearch"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/d64/namespaceinterpolation__search.html">interpolation_search</a></td></tr>
<tr class="memdesc:d1/d64/namespaceinterpolation__search"><td class="mdescLeft">&#160;</td><td class="mdescRight">Functions for the Recursive version of Inorder, Preorder, and Postorder <a href="https://en.wikipedia.org/wiki/Tree_traversal" target="_blank">Traversal of the Tree</a> algorithm implementation. <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:a951f01040f518d611228c1d182b8242c" id="r_a951f01040f518d611228c1d182b8242c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a951f01040f518d611228c1d182b8242c">others::recursive_tree_traversals::deleteAll</a> (const <a class="el" href="../../d9/df7/structothers_1_1recursive__tree__traversals_1_1_node.html">Node</a> *const root)</td></tr>
<tr class="separator:a951f01040f518d611228c1d182b8242c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1440a7779ac56f47a3f355ce4a8c7da0" id="r_a1440a7779ac56f47a3f355ce4a8c7da0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a> ()</td></tr>
<tr class="memdesc:a1440a7779ac56f47a3f355ce4a8c7da0"><td class="mdescLeft">&#160;</td><td class="mdescRight">1st test-case <br /></td></tr>
<tr class="separator:a1440a7779ac56f47a3f355ce4a8c7da0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0283886819c7c140a023582b7269e2d0" id="r_a0283886819c7c140a023582b7269e2d0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0283886819c7c140a023582b7269e2d0">test2</a> ()</td></tr>
<tr class="memdesc:a0283886819c7c140a023582b7269e2d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">2nd test-case <br /></td></tr>
<tr class="separator:a0283886819c7c140a023582b7269e2d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d0455dd5c30adda100e95f0423c786e" id="r_a6d0455dd5c30adda100e95f0423c786e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a6d0455dd5c30adda100e95f0423c786e">test3</a> ()</td></tr>
<tr class="memdesc:a6d0455dd5c30adda100e95f0423c786e"><td class="mdescLeft">&#160;</td><td class="mdescRight">3rd test-case <br /></td></tr>
<tr class="separator:a6d0455dd5c30adda100e95f0423c786e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a483bb8ccf42aaf7375a83e91490eda1e" id="r_a483bb8ccf42aaf7375a83e91490eda1e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a483bb8ccf42aaf7375a83e91490eda1e">tests</a> ()</td></tr>
<tr class="memdesc:a483bb8ccf42aaf7375a83e91490eda1e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <br /></td></tr>
<tr class="separator:a483bb8ccf42aaf7375a83e91490eda1e"><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>Recursive version of Inorder, Preorder, and Postorder [Traversal of the Tree] (<a href="https://en.wikipedia.org/wiki/Tree_traversal">https://en.wikipedia.org/wiki/Tree_traversal</a>) </p>
<h3><a class="anchor" id="autotoc_md99"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md99"></a>
Iterative Inorder Traversal of a tree</h3>
<p>For traversing a (non-empty) binary tree in an inorder fashion, we must do these three things for every node n starting from the trees root:</p>
<p>(L) Recursively traverse its left subtree. When this step is finished, we are back at n again. (N) Process n itself. (R) Recursively traverse its right subtree. When this step is finished, we are back at n again.</p>
<p>In normal inorder traversal, we visit the left subtree before the right subtree. If we visit the right subtree before visiting the left subtree, it is referred to as reverse inorder traversal.</p>
<h3><a class="anchor" id="autotoc_md100"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md100"></a>
Iterative Preorder Traversal of a tree</h3>
<p>For traversing a (non-empty) binary tree in a preorder fashion, we must do these three things for every node n starting from the trees root:</p>
<p>(N) Process n itself. (L) Recursively traverse its left subtree. When this step is finished, we are back at n again. (R) Recursively traverse its right subtree. When this step is finished, we are back at n again.</p>
<p>In normal preorder traversal, visit the left subtree before the right subtree. If we visit the right subtree before visiting the left subtree, it is referred to as reverse preorder traversal.</p>
<h3><a class="anchor" id="autotoc_md101"></a>
<h3 class="doxsection"><a class="anchor" id="autotoc_md101"></a>
Iterative Postorder Traversal of a tree</h3>
<p>For traversing a (non-empty) binary tree in a postorder fashion, we must do these three things for every node n starting from the trees root:</p>
<p>(L) Recursively traverse its left subtree. When this step is finished, we are back at n again. (R) Recursively traverse its right subtree. When this step is finished, we are back at n again. (N) Process n itself.</p>
@@ -201,7 +179,7 @@ Iterative Postorder Traversal of a tree</h3>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Lazeeez" target="_blank">Lajat Manekar</a> </dd></dl>
<p class="definition">Definition in file <a class="el" href="../../dc/de1/recursive__tree__traversal_8cpp_source.html">recursive_tree_traversal.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="a951f01040f518d611228c1d182b8242c" name="a951f01040f518d611228c1d182b8242c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a951f01040f518d611228c1d182b8242c">&#9670;&#160;</a></span>deleteAll()</h2>
@@ -508,7 +486,7 @@ Iterative Postorder Traversal of a tree</h3>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void tests </td>
<td class="memname">void tests </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
@@ -541,11 +519,19 @@ Iterative Postorder Traversal of a tree</h3>
</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_9510827d0b234b3cc54b29892f217477.html">others</a></li><li class="navelem"><a class="el" href="../../dc/de1/recursive__tree__traversal_8cpp.html">recursive_tree_traversal.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_9510827d0b234b3cc54b29892f217477.html">others</a></li><li class="navelem"><a href="../../dc/de1/recursive__tree__traversal_8cpp.html">recursive_tree_traversal.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>