Open In App

UGC-NET | UGC-NET CS 2017 Dec 2 | Question 25

Like Article
Like
Save
Share
Report

Postorder traversal of a given binary search tree T produces following sequence of keys:
3, 5, 7, 9, 4, 17, 16, 20, 18, 15, 14
Which one of the following sequences of keys can be the result of an in-order traversal of the tree T?
(A) 3, 4, 5, 7, 9, 14, 20, 18, 17, 16, 15
(B) 20, 18, 17, 16, 15, 14, 3, 4, 5, 7, 9
(C) 20, 18, 17, 16, 15, 14, 9, 7, 5, 4, 3
(D) 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20


Answer: (D)

Explanation: Since Inorder traversal of a BST always gives elements in increasing order. For this question sorted order of keys will always be the in-order tree traversal for post-order traversal.
So, option (D) is correct.

Quiz of this Question


Last Updated : 15 Mar, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads