Exam-style question
Try this first
Use the following tree to trace all three traversal algorithms. The root is K. K has left child D and right child S. D has left child B and right child G. S has left child N and right child W. State the pre-order, in-order and post-order sequences. Also state one specified use for each traversal.
Answer and explanation
Concise answer
Pre-order: K, D, B, G, S, N, W.
Why this is correct
Pre-order processes the current node before its subtrees, so K is first, followed by the complete left subtree and then the complete right subtree. In-order processes the left subtree, then the current node, then the right subtree. Post-order processes both subtrees before the current node, so K is last. The uses match the specified applications of each traversal.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
