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
- Mango
- Carrot
- Apple
- Banana
اس سوال کو وضاحت کے ساتھ پڑھیں
- Painting
- Sketch
- Drawing
- Picture
اس سوال کو وضاحت کے ساتھ پڑھیں
- A
- B
- C
- Both b & c
اس سوال کو وضاحت کے ساتھ پڑھیں
- 7677: 77767: 77767
- 7677: 76767: 77677
- 7677: 77667: 77767
- 77677: 76767: 77767
اس سوال کو وضاحت کے ساتھ پڑھیں
Leave a Reply
Your email address will not be published. Required fields are marked *