# In-order traversal & Post-order traversal
# In-Order Traversal
In-order traversal is depth first traversal.
We follow the rule :
<left><Node><right>
, which means starting with root node, untill there is a left child we move left, when we reach a node which does not have a left child or left child is traversed we print its value and then we move to the right child and repeat the process.In-order traversal of the example is : 1, 3, 4, 6, 7, 8, 10, 13, 14.
In-order traversal always gives values in ascending order.
# Post-Order Traversal
Post-order traversal is depth first traversal.
We follow the rule :
<left><right><Node>
, which means starting with root node, untill there is a left child we move left, if there is no left child we move to the right child and repeat the process. when we reach a node with no left and right child or both left and right child traversed, we print its value.Pre order traversal of the example is : 1, 4, 7, 6, 3, 13, 14, 10, 8.
Learn More
- BST - In-order traversal & Post-order traversal