ITPEC FE Subject A April 2026 Question 6
Topic: Algorithm and ProgrammingAlso asked in October 2023
In the binary search tree below, when a new node of value 11 is inserted, where will this insertion be made?
Explanation
Right child of 10 — a new key is inserted as a leaf where the search for it runs off the tree.
Compare 11 with each node from the root:
- •11 < 14 → go left to 7
- •11 > 7 → go right to 12
- •11 < 12 → go left to 10
- •11 > 10 → go right; 10 has no right child, so 11 goes there
Answer (d)
Why not others:
- •(a) Left child of 16 and (b) Left child of 23 — both are in the right subtree of 14, but 11 < 14 sends the search left at the root
- •(c) Right child of 3 — reaching 3 requires going left at 7, yet 11 > 7 goes right
Key rule: BST insertion follows the same path as a search and attaches the new key at the empty slot where that search ends, without restructuring the tree.
Algorithm and Programming · AI-written, may contain errors
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.