edited by
4,857 views
23 votes
23 votes

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

edited by

4 Answers

Best answer
28 votes
28 votes

Answer is D.

Inorder traversal is left node right.

Preorder is node left right.

3 votes
3 votes
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
3 votes
3 votes
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
Answer:

Related questions

51 votes
51 votes
4 answers
1
24 votes
24 votes
1 answer
2
65 votes
65 votes
9 answers
3
Ishrat Jahan asked Nov 1, 2014
24,560 views
Let $P$ be a singly linked list. Let $Q$ be the pointer to an intermediate node $x$ in the list. What is the worst-case time complexity of the best-known algorithm to del...
41 votes
41 votes
6 answers
4
Ishrat Jahan asked Nov 2, 2014
11,826 views
A process executes the following segment of code :for(i = 1; i <= n; i++) fork ();The number of new processes created is$n$$((n(n + 1))/2)$$2^n - 1$$3^n - 1$