Binary Search & Balanced Trees

Answer & solution
Answer: D (no official key was published)
For D, root 5 divides the remaining sequence into left subtree 3, 1, 2, 4 and right subtree 7, 6, 8. In the left subtree, 3 has left subtree 1→right child 2 and right child 4. In the right subtree, 7 has children 6 and 8. This constructs the required BST. A gives 7, 8, 6 after entering root 7’s right subtree before returning to a smaller value 6. B returns to 4 after beginning root 5’s right subtree at 6. C returns to 1 after entering the right subtree of 3 at 4. These violate preorder’s contiguous subtree blocks, leaving D.