Make your own free website on Tripod.com
SLIDE 106

Printing the nodes of a binary tree:

void print_tree (binary_tree *t)
{
  if (! is_empty(t)) {
    print_tree(t->left);     /* L */
    print_tree(t->right);    /* R */
    printf("%d\n",t->value); /* N */
  }
}

Pre-Order: A B D C E F

In-Order: B D A E C F

Post-Order: D B E F C A

Breadth First Traversal: proceeds level by level. First the root is processed, then all of its children, then all of their children, etc, down to the bottom level.

Breadth First: A B C D E F