======================================================= _______________________________ Recursive In-order traversal - Traverse the left (recursive) - Visit the root - Traverse the right (recursive) _______________________________ Iterative in-order traversal "Visit" = do something (e.g., print the value) Push the root (so that we can remember to visit it and everything in its right subtree. Go to its left subtree. Repeat. Push 4 node Go down its left subtree. (curr = curr -> left) Push 2 node Go down its left subtree. (curr = curr -> left) Push 1 node (nothing to do for its left subtree) Pop gives us the 1 node # Whenever we pop, we will "visit" the node we popped, and push its right subtree. Print "1" (nothing to do for its right subtree) Pop gives us the 2 node # Whenever we pop, we will "visit" the node we popped, and push its right subtree. Print "2" Push the 3 node (nothing to do for its left subtree) Pop gives us the 3 node again TRAVERSALS _______________________________ Iterative pre-order traversal Visit the root to get "curr" Push its right subtree Push its left subtree Pop to get a new "curr" Visit curr Push its right subtree Push its left subtree _______________________________ Iterative post-order traversals Push right subtree Push the "curr" Go to the left subtree (curr = curr -> left) If curr is NULL: Pop the stack to get a new curr