GATE 2018

Question 12

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 _______.

A
1
B
2
C
3
D
4
Question 12 Explanation: 
Post – 8 9 6 7 4 5 2 3 1
In – 8 6 9 4 7 2 5 1 3
Post: 8 9 6 7 4 5 2 3 1→(root)
In: 8 6 9 4 7 2 5→(left subtree) 13→(right subtree)



Correct Answer: D
Question 12 Explanation: 
Post – 8 9 6 7 4 5 2 3 1
In – 8 6 9 4 7 2 5 1 3
Post: 8 9 6 7 4 5 2 3 1→(root)
In: 8 6 9 4 7 2 5→(left subtree) 13→(right subtree)



0 0 votes
Article Rating
Subscribe
Notify of


0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: <b>Alert: </b>Content selection is disabled!!
Software-Engineering
February 22, 2024
Question 7834 – GATE 2018
February 23, 2024
Software-Engineering
February 22, 2024
Question 7834 – GATE 2018
February 23, 2024