ITPEC FE Morning October 2023 Question 8

Source exam: ITPEC FE Morning October 2023Topic: Basic Theory & Math

ITPEC FE Morning October 2023 — Question 8 of 80

BST Insertion — find the correct position for a new node by traversing left/right.

Insert 11 into the given BST:

  • 14 → 11 < 14 → go left
  • 7 → 11 > 7 → go right
  • 12 → 11 < 12 → go left
  • 10 → 11 > 10 → go right → empty slot → insert here

Result: 11 becomes the right child of 10.

Why not others:
- (a) Left child of 16 — 11 < 14, so we never enter the right subtree of root

- (b) Left child of 23 — same reason; 11 stays in the left subtree

- (c) Right child of 3 — at node 7, 11 > 7, so we go right (to 12), not left (to 3)

Key rule: In a BST, traverse left if value < node, right if value > node, until an empty child slot is found.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.