Preorder Traversal | Postorder Traversal | Inorder Traversal

  1. Visit the root.
  2. Traverse the left subtree.
  3. 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