//In-Order traversal
void inOrderTraversal(TreeNode node)
{
if(node != null)
{
inOrderTraversal(node.left);
visit(node);
inOrderTraversal(node.right);
}
}
//Pre-Order traversal
void preOrderTraversal(TreeNode node)
{
if(node !=null )
{
visit(node);
preOrderTraversal(node.left);
preOrderTraversal(node.right);
}
}
//Post-Order traversal
void postOrderTraversal(TreeNode node)
{
if(node !=null )
{
postOrderTraversal(node.left);
postOrderTraversal(node.right);
visit(node);
}
}
Feature: Each node is smaller than its children. The root is the minimum element in the tree.