When in-order traversing a tree resulted in E A C K F H D B G; the preorder traversal would return?
- FAEKCDHGB
- FAEKCDBHG
- EAFKHDCBG
- FEAKDCHBG
Explanation
E: This is the leftmost node in the in-order sequence. It becomes the root in the preorder traversal.
A: The next node after E is its left child. So, A is the left child of E.
C: Moving further, C is the right child of A.
K: K is the right child of C.
F: F is the right child of K.
H: H is the right child of F.
D: D is the left child of F.
B: B is the left child of A.
G: Finally, G is the right child of B.
Putting it all together, we get the preorder traversal: FAEKCDHGB.
Related MCQs
- BHGPDZ
- BHFODZ
- BHFOBZ
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
- IPOFUV
- IPPGTUU
- IPQHUVV
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
- Box B
- Box C
- Box D
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
- Grandson
- Cousin
- Nephew
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
- East
- West
- North
- None of these