Binary Trees

Terminology

Traversals

Visiting each node in a specific order.

Traversal Order of Visit Description
Pre-order Root → Left → Right Visit the root first, then subtrees
In-order Left → Root → Right Visit left subtree, then root, then right
Post-order Left → Right → Root Visit both subtrees before the root

In-order Traversal :

  1. Begin at the root.
  2. Traverse the left subtree.
  3. Visit (report) the current node.
  4. Traverse the right subtree.

(always go back to the root of each node! -At every subtree repeat the same process recursively.)