In-order traversal: 24,17,32,18,51,11,26,39,43
Pre-order traversal: 11,32,24,17,51,18,43,26,39
The question asked to find which nodes belong on the right subtree of the root node. I am having trouble constructing the tree based on the 2 traversal methods..
Would greatly appreciate some help on this.
1 Answer 1
The tree that is defined by those two traversals is:
__ 11 __
/ \
_ 32 _ 43
/ \ /
24 51 26
\ / \
17 18 39
The procedure to build this, is described in this Q&A
answered Apr 4, 2022 at 4:29
trincot
357k38 gold badges282 silver badges338 bronze badges
Sign up to request clarification or add additional context in comments.
left < root < rightwhich a binary tree does not have.