Skip to content
Official PYQ · 2015

GATE CS 2015 Set 3 Q13 — Binary Search Trees

Explain with AI

While inserting the elements 71,65,84,69,67,8371, 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
View worked solution

Answer: B

To find the element at the lowest (deepest) level, we insert the elements into an initially empty Binary Search Tree (BST) one by one in the given sequence: 71,65,84,69,67,8371, 65, 84, 69, 67, 83.

Recall the BST insertion rule: for any node, elements smaller than the node go to its left subtree, and elements larger go to its right subtree.

  1. Insert 7171: This becomes the root node.
           71 (Level 0)
        
  2. Insert 6565: Since 65<7165 < 71, it becomes the left child of 7171.
           71 (Level 0)
          /
         65 (Level 1)
        
  3. Insert 8484: Since 84>7184 > 71, it becomes the right child of 7171.
           71 (Level 0)
          /  \
         65   84 (Level 1)
        
  4. Insert 6969:
    • 69<71  ⟹  69 < 71 \implies go left to 6565
    • 69>65  ⟹  69 > 65 \implies right child of 6565
           71 (Level 0)
          /  \
         65   84 (Level 1)
          \
           69 (Level 2)
        
  5. Insert 6767:
    • 67<71  ⟹  67 < 71 \implies go left to 6565
    • 67>65  ⟹  67 > 65 \implies go right to 6969
    • 67<69  ⟹  67 < 69 \implies left child of 6969
           71 (Level 0)
          /  \
         65   84 (Level 1)
          \
           69 (Level 2)
          /
         67 (Level 3)
        
  6. Insert 8383:
    • 83>71  ⟹  83 > 71 \implies go right to 8484
    • 83<84  ⟹  83 < 84 \implies left child of 8484
           71 (Level 0)
          /  \
         65   84 (Level 1)
          \   /
          69 83 (Level 2)
          /
         67 (Level 3)
        

Summarizing the levels of each node:

  • Level 0: 7171
  • Level 1: 65,8465, 84
  • Level 2: 69,8369, 83
  • Level 3: 6767

The element at the lowest level (deepest level) is 6767.

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

Published
Report a correction
Keep exploringMore Binary Search Trees questions