Documentation for 274cab6914

This commit is contained in:
github-actions
2022-06-09 15:34:50 +00:00
parent a0e8991686
commit 4a12e7fa89
76 changed files with 1255 additions and 815 deletions

View File

@@ -148,17 +148,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_md97"></a>
<h3><a class="anchor" id="autotoc_md96"></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_md98"></a>
<h3><a class="anchor" id="autotoc_md97"></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_md99"></a>
<h3><a class="anchor" id="autotoc_md98"></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>