Tree traversal: Difference between revisions

Content deleted Content added
Traversal methods: wiki link recursive algorithm
Line 15:
</pre>
 
This [[recursive algorithm]] prints the values in the tree in '''pre-order'''. In pre-order, each node is visited before any of its children. Similarly, if the print statement were last, each node would be visited after all of its children, and the values would be printed in '''post-order'''. In both cases, values in the left subtree are printed before values in the right subtree.
 
<pre>