Preorder Traversal |
Postorder Traversal |
Inorder Traversal
- Visit the root.
- Traverse the left subtree.
- Traverse the right subtree.
For those of us who are visual learners, preorder traversal of a binary tree would look something like this.
A depth = 0
/ \
B D depth = 1
/ / \
C E F depth = 2