Question

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is

Choose one option
Official answer and solution
Official answer
B
From
Official GATE 2015 answer key

Solution

Trace the step-by-step insertion of keys into a Binary Search Tree and record the depth of each node.

Insert the elements 71, 65, 84, 69, 67, 83 into an initially empty BST:

  1. Insert 71: Root node at Level 0.
  2. Insert 65: 65<7165 < 71, placed as the left child of 71 (Level 1).
  3. Insert 84: 84>7184 > 71, placed as the right child of 71 (Level 1).
  4. Insert 69: 69<7169 < 71 (left), 69>6569 > 65 (right), placed as the right child of 65 (Level 2).
  5. Insert 67: 67<7167 < 71 (left), 67>6567 > 65 (right), 67<6967 < 69 (left), placed as the left child of 69 (Level 3).
  6. Insert 83: 83>7183 > 71 (right), 83<8483 < 84 (left), placed as the left child of 84 (Level 2).

The levels of the nodes are:

  • Level 0: 71
  • Level 1: 65, 84
  • Level 2: 69, 83
  • Level 3: 67

The element at the lowest level (greatest depth) is 67 at Level 3 (Option B).

Final answer

B

Common trap

Assuming the lowest level corresponds to the minimum numeric value (65) rather than the node with the maximum tree depth.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 3
Question
23 of 65, printed as CS Q.13
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.