Documentation for db3f9d3406

This commit is contained in:
realstealthninja
2024-10-28 15:53:44 +00:00
parent fe2cc4c065
commit 4b0a624473
93 changed files with 1589 additions and 328 deletions

View File

@@ -164,17 +164,17 @@ Functions</h2></td></tr>
</table>
<a name="details" id="details"></a><h2 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_md98"></a>
<h3><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_md99"></a>
<h3><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_md100"></a>
<h3><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>