Skip to content
Related Articles

Related Articles

GATE | GATE CS 2018 | Question 20
  • Last Updated : 23 Feb, 2018

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

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :