trees :: traversals

Pre order Traversal

The root is visited first, then the left child and last, the right child.

Post order Traversal

Visits children nodes first (left to right) before the root. It could be used to figure out disk space.

In order Traversal

Defined as visiting the left child first, then the root node and last the right child. Inorder traversal gives us a natural way of writing an expression tree.

Expression Tree