GATE Computer ScienceModerateGATE CS (PYQ pattern)
How many binary search trees on the keys 1, 2, …, 9 have 4 at the root and 7 as the right child of the root?
- A. 20
- B. 210
- C. 42
- D. 25
Correct answer: A. 20
Left subtree of 4: keys 1–3, C₃ = 5 shapes. Right subtree: keys 5–9 with root 7, whose left subtree is {5, 6} (C₂ = 2) and right subtree is {8, 9} (C₂ = 2). Total 5 · 2 · 2 = 20.
More Discrete Mathematics questions
- How many permutations of {1, …, 8} have no cycle of length 1 or 2 (every cycle has length ≥ 3)?
- How many permutations π of {1, …, 8} satisfy π² = identity with none of 1, 2, 3 being a fixed point?
- In an election A gets 10 votes and B gets 6. Votes are counted one at a time (votes for the same candidate indistinguishable). In how many…
- T(0) = T(1) = 1 and T(n) = T(n − 1) + T(n − 2) + n for n ≥ 2. What is T(12)?
- In how many ways can 16 be written as an ordered sum (a composition) of parts each equal to 1, 3 or 4?
- How many ordered 5-tuples of positive odd integers, each at most 9, sum to 25?