A binary search tree is constructed by inserting the following numbers in…

2018

A binary search tree is constructed by inserting the following numbers in order :

60,25,72,15,30,68,101,13,18,47,70,34

The number of nodes in the left subtree is

  1. A.

    5

  2. B.

    6

  3. C.

    7

  4. D.

    3

Attempted by 390 students.

Show answer & explanation

Correct answer: C

Solution: Build the binary search tree by inserting the numbers in the given order and then count the nodes in the left subtree of the root (60).

All numbers less than 60 go into the left subtree. From the insertion order, the numbers that are less than 60 are: 25, 15, 30, 13, 18, 47, 34.

  • 25 is the left child of 60.

  • 15 is the left child of 25; 15 has left child 13 and right child 18.

  • 30 is the right child of 25; 30 has right child 47.

  • 47 is the right child of 30 and has left child 34.

Count: The left subtree nodes are 25, 15, 30, 13, 18, 47, 34 — a total of 7 nodes.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Coding For Placement