Tree traversal
Contents
Tree traversal
Depth-first search of binary tree
Pre-order (NLR)
For Preorder, you traverse from the root to the left subtree then to the right subtree.
Preorder => Root, Left, Right.
In-order (LNR)
For Inorder, you traverse from the left subtree to the root then to the right subtree.
Inorder => Left, Root, Right.
Reverse in-order (RNL)
Post-order (LRN)
For Post order, you traverse from the left subtree to the right subtree then to the root.
Post order => Left, Right, Root.