Documentation for 0fea073413

This commit is contained in:
github-actions
2022-10-25 21:38:38 +00:00
parent 179526ce7a
commit 54cd9079ad
1772 changed files with 5550 additions and 5247 deletions

View File

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