4,062 views

Which one of the following binary trees has its inorder and preorder traversals as $BCAD$  and $ABCD$, respectively?

### 1 comment

In Preorder 1st element is root and everything to left of it in inorder is in LST and right is in RST.

So A is root with BC in LST and D in RST. Option A,C eliminated.

From BC, in preorder B is first so it should be the root. B is elminnated.

Also as C is after it in inorder it should be in RST(with B as root). So D would be correct.

Inorder traversal is left node right.

Preorder is node left right.

D is correct rt?
ya D is correct. mistake edited in the answer :)

Try it ..

I have seen this figure on 3 questions. In how many questions same figure.

Inorder traversal 1) Traverse the left subtree 2) Visit the root 3) Traverse the right subtree Preorder traversal 1) Visit the root 2) Traverse the left subtree 3) Traverse the right subtree
ans is d

in order left-root-right

preorder root-left right

after applying above formula we get exactly what they asking so d is correct

By this way we can create tree and Check options so option D is answer

1
8,500 views