retagged by
18,867 views
8 votes
8 votes

The preorder traversal of a binary search tree is $15, 10, 12, 11, 20, 18, 16, 19$. Which one of the following is the postorder traversal of the tree?

  1. $10,11,12,15,16,18,19,20$
  2. $11,12,10,16,19,18,20,15$
  3. $20,19,18,16,15,12,11,10$
  4. $19,16,18,20,11,12,10,15$
retagged by

5 Answers

0 votes
0 votes
To get the answer quickly, just identify the root element which is by preorder traversal is 15, so A,C cannot be the answer. For the remaining option,given that the tree is BST, the right subtree’s value is greater than the root’s value so D cannot be the answer. So, the answer is B.
Answer:

Related questions

29 votes
29 votes
4 answers
5
Arjun asked Feb 12, 2020
21,984 views
In a balanced binary search tree with $n$ elements, what is the worst case time complexity of reporting all elements in range $[a,b]$? Assume that the number of reported ...
27 votes
27 votes
2 answers
6
Arjun asked Feb 12, 2020
13,666 views
What is the worst case time complexity of inserting $n^{2}$ elements into an AVL-tree with $n$ elements initially?$\Theta (n^{4})$$\Theta (n^{2})$$\Theta (n^{2}\log n)$$\...
36 votes
36 votes
9 answers
7
Arjun asked Feb 12, 2020
26,559 views
What is the worst case time complexity of inserting $n$ elements into an empty linked list, if the linked list needs to be maintained in sorted order?$\Theta(n)$$\Theta(n...