How many distinct binary search trees can be formed using 5 distinct keys?
Options
- A. 14
- B. 42
- C. 120
- D. More than one of the above
- E. None of the above
Quiz Practice:
B. 42
The number of distinct BSTs formed from N distinct keys is the Catalan number CN. For five keys, C5 = 42. The recurrence can also be written as CN = Σ CiCN-1-i, where each possible key is considered as the root and the remaining keys are divided between the left and right subtrees. This recurrence explains why the number grows rapidly.