Similar questions 4 more →
Tree Properties & Traversals

Shared context
Find every ordered binary tree containing exactly the distinct labels A, B, C whose preorder sequence is C,B,A. Left and right child positions are distinguished.
Answer & solution
Answer: Exactly 5 ordered binary trees (no official key was published)
1. Use the first preorder symbol to fix the root. Preorder visits root, then left subtree, then right subtree. Therefore every requested tree must have C at its root.
2. Partition the two remaining nodes between C’s subtrees. The possible left/right subtree sizes are (2,0), (0,2), and (1,1). These cases exhaust the possibilities because there are exactly two nodes besides C.
3. Handle the two single-subtree cases. For sizes (2,0), B is C’s left child, and A is either B’s left child or B’s right child: two trees. For sizes (0,2), B is C’s right child, and A again has two child positions: two more trees. B must precede A because their subtree’s preorder must be B,A.
4. Handle sizes (1,1). Preorder visits the entire left subtree before the right, so the left child is B and the right child is A: one tree. Reversing those children would give C,A,B and is not allowed.
5. Draw the resulting 2 + 2 + 1 = 5 ordered binary trees:
(1) C (2) C
/ /
B B
/ \
A A
(3) C (4) C
\ \
B B
/ \
A A
(5) C
/ \
B A
6. Verify each tree by reading root-left-right. Each gives C,B,A. The exhaustive subtree-size split proves that no additional ordered binary-tree shape can qualify. In explicit node(left,right) notation, with - for no child, the five trees are C(B(A(-,-),-),-), C(B(-,A(-,-)),-), C(-,B(A(-,-),-)), C(-,B(-,A(-,-))), and C(B(-,-),A(-,-)).