This question was previously asked in

GATE CS 2013 Official Paper

Option 4 : 15, 10, 23, 25, 20, 35, 42, 39, 30

IBPS SO IT Officer Mains: Full Mock Test

5354

60 Questions
60 Marks
45 Mins

The correct answer is "**option 4".**

__CONCEPT:__

A Binary Search Tree (BST) is also known as an **ordered tree** or **sorted binary tree.**

It is a binary tree with the following properties:

1. The **left sub-tree** of a node contains only nodes with key-value **lesser** than the node’s key value.

2. The **right subtree** of a node contains only nodes with a key-value **greater** than the node’s key value.

There are **three types** of traversal:

1. **In-order traversal:** In this traversal, the first left node will traverse, the root node then the right node will get traversed.

2. **Pre-order traversal**: In this traversal, the first root node will traverse, the left node then the right node will get traversed.

3. **Post-order traversal**: In this traversal, the First left node will traverse, the right node then the root node will get traversed.

The in-order traversal of the Binary search tree always returns key values in ascending order.

__EXPLANATION:__

The **pre-order traversal** of given BST is:

30, 20, 10, 15, 25, 23, 39, 35, 42.

So, the **In-order traversal** of the BST is:

10, 15, 20, 23, 25, 30, 35, 39, 42.

The **Binary Search Tree **is:

So the post-order traversal of the tree is:

**15, 10, 23, 25, 20, 35, 42, 39, 30**

**Hence, the correct answer is "option 4".**