A binary search tree is a binary tree in which:
2012
A binary search tree is a binary tree in which:
Answer: D. All of the above — ConceptA binary search tree (BST) maintains an ordering invariant at every node: keys in its left subtree are smaller than the node’s key, while keys in its…
- A.
All items in the left subtree are less than the root
- B.
All items in the right subtree are greater than or equal to the root
- C.
Each subtree is itself a binary search tree
- D.
All of the above
Attempted by 26 students.
Show answer & explanation
Correct answer: D
Concept
A binary search tree (BST) maintains an ordering invariant at every node: keys in its left subtree are smaller than the node’s key, while keys in its right subtree follow the chosen greater-than-or-equal duplicate policy.
The invariant is recursive: the left and right subtrees must themselves satisfy the same binary-search-tree conditions.
Application
Take any node with key r as a local root.
The statement “All items in the left subtree are less than the root” supplies the left-order condition.
The statement “All items in the right subtree are greater than or equal to the root” supplies the right-order and duplicate-placement condition.
The statement “Each subtree is itself a binary search tree” extends both conditions recursively to every descendant.
Contrast
Each individual statement captures only one part of the complete definition:
“All items in the left subtree are less than the root” states only the left-side inequality.
“All items in the right subtree are greater than or equal to the root” states only the right-side inequality and duplicate policy.
“Each subtree is itself a binary search tree” states the recursive requirement.
“All of the above” combines the three stated requirements.
Cross-check and result
For a root 8 with left child 4, right child 10, and a duplicate 8 placed in the right subtree, every key on the left of the root is below 8, every key on the right is at least 8, and the same local rule applies inside each subtree.
Thus all three listed properties are used together, so the answer is “All of the above”.