Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE CS 2018 | Question 20

  • Last Updated : 12 Aug, 2021

The postorder traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The inorder traversal of the same tree is 8, 6, 9, 4, 7, 2, 5, 1, 3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ________ .

Note –This was Numerical Type question.
(A) 2
(B) 3
(C) 4
(D) 5


Answer: (C)

Explanation: Given, post-order – 8, 9, 6, 7, 4, 5, 2, 3, 1
and in-order – 8, 6, 9, 4, 7, 2, 5, 1, 3

Construct a binary tree from postorder and inorder traversal :

5

The height of the binary tree above is 4.





Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :