How many distinct binary search trees can be created out of 4 distinct keys?
Options
- A. 8
- B. 24
- C. 14
- D. More than one of the above
- E. None of the above
C. 14
Explanation:
The number of distinct Binary Search Trees (BSTs) that can be formed with n distinct keys is given by the Catalan Number formula.
For n keys:
Cn=(n+1)!n!(2n)!
For n = 4:
C4=5!×4!(8)!=14
So, 14 different BSTs can be formed using 4 distinct keys.
Attempt Quiz Now:
BPSC Tre 4.0 DSA Practice Set