Binary Search Trees¶
Traversal¶
Inorder Traversal¶
Procedure:
- Traverse Left subtree
- Visit node
- Traverse Right subtree
public static void inOrder(Node root) {
if (root == null){
return;
}
inOrder(root.left);
System.out.print(root.data + " ");
inOrder(root.right);
}
Preorder Traversal¶
Procedure:
- Visit node
- Traverse Left subtree
- Traverse Right subtree
Postorder Traversal¶
Procedure:
- Traverse Left subtree
- Traverse Right subtree
- Visit node