What is the preorder traversal of the binary tree described below? A is the…
2025
What is the preorder traversal of the binary tree described below?
A is the root.
B and C are the left and right children of A, respectively.
D and E are the left and right children of B, respectively.
Answer: B. ABDEC — ConceptPreorder traversal processes each node before its subtrees. Its fixed order is root, then the complete left subtree, then the complete right subtree.…
- A.
DEBCA
- B.
ABDEC
- C.
DBEAC
- D.
ADBEC
Attempted by 337 students.
Show answer & explanation
Correct answer: B
Concept
Preorder traversal processes each node before its subtrees. Its fixed order is root, then the complete left subtree, then the complete right subtree.
Application
Start at root A, so A is visited first.
Enter A’s left subtree at B and visit B before B’s children.
Traverse B’s left child D, followed by B’s right child E.
After completing the left subtree, traverse A’s right child C.
Cross-check
A occurs before both B and C, as required for the root.
Within B’s subtree, B occurs before D and E.
The entire B subtree is completed before C.
Therefore, the preorder traversal is ABDEC.