Skip to content
GATEiit

GATE CSE 2017 Session 2 Q46: Post-order traversal of a BST from its pre-order traversal

Syllabus topic: Trees, binary search trees and binary heaps

Question

The pre-order traversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: B (official GATE 2017 final answer key)

Concept used: In a BST, the pre-order sequence (root first) together with the ordering property determines the tree uniquely; post-order visits left subtree, right subtree, then root.

Concept notes

Loading notes…

First step: Take 12 as the root; the following keys smaller than 12 form the left subtree and the larger ones the right subtree, and recurse.

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Trees, binary search trees and binary heaps

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key