Question 12Asked in UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)

Post order traversal of a given binary search tree T produces following sequence of keys : Which one of the following sequences of keys can be the result of…

Post order traversal of a given binary search tree T produces following sequence of keys : Which one of the following sequences of keys can be the result of an in-order traversal of the tree T?
  1. A3, 4, 5, 7, 9, 14, 20, 18, 17, 16, 15
  2. B20, 18, 17, 16, 15, 14, 3, 4, 5, 7, 9
  3. C20, 18, 17, 16, 15, 14, 9, 7, 5, 4, 3
  4. D3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20
Show answerHide answer

Correct answer: (D) 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20

Explanation

An in-order traversal of a binary search tree always gives the keys in ascending order, so the in-order sequence is 3, 4, 5, 7, 9, 14, 15, 16, 17, 18, 20.

From UGC NET Computer Science PYQ, November 2017 (Paper II & III, Selected Questions)

This is question 12 of UGC NET Computer Science PYQ, November 2017 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.