Skip to content
Official PYQ · 2003

GATE CS 2003 Q19 — Binary Search Trees

Explain with AI

Suppose the numbers 7,5,1,8,3,6,0,9,4,27, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree?

Choose one option
View worked solution

Answer: C

A fundamental property of any Binary Search Tree (BST) is that its in-order traversal always yields the keys in sorted ascending order.

The set of numbers inserted into the BST is:

{7,5,1,8,3,6,0,9,4,2}\{7, 5, 1, 8, 3, 6, 0, 9, 4, 2\}

Sorting these distinct numbers in ascending order gives:

0,1,2,3,4,5,6,7,8,90, 1, 2, 3, 4, 5, 6, 7, 8, 9

Therefore, without needing to construct the tree, we can directly determine that the in-order traversal sequence is:

0 1 2 3 4 5 6 7 8 9

This matches Option C.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Binary Search Trees questions