Given a binary tree, which traversal visits the root node first, then the left subtree, and finally the right subtree?
Think about which traversal starts by visiting the root node before its children.
Preorder traversal visits the root node first, then recursively visits the left subtree, followed by the right subtree.
What is the output sequence of an inorder traversal on the following binary tree?
2
/ \
1 3
Inorder traversal visits left subtree, root, then right subtree.
Inorder traversal visits nodes in ascending order for a binary search tree: left child (1), root (2), right child (3).
Consider this binary tree:
A
/ \
B C
/ / \
D E F
What is the postorder traversal output?
Postorder traversal visits left subtree, right subtree, then root.
Postorder visits D (leftmost), then B, then E and F (right subtree), then C, and finally root A.
Which statement correctly compares preorder and postorder traversals of a binary tree?
Think about when the root node is visited in each traversal.
Preorder traversal visits the root node first, while postorder traversal visits it last after its children.
A binary tree has 7 nodes. How many nodes will be visited during a complete preorder traversal?
Traversal visits every node exactly once.
Preorder traversal visits every node in the tree exactly once, so all 7 nodes are visited.