How many distinct binary search trees can be created out of 4 distinct...
To determine the number of distinct binary search trees (BSTs) that can be created out of 4 distinct keys, we can use the concept of Catalan numbers.
Catalan numbers are a sequence of natural numbers that often appear in various combinatorial problems, including counting the number of BSTs. The formula to calculate the nth Catalan number is given by:
C(n) = (2n)! / ((n + 1)! * n!)
In this case, we want to find the number of distinct BSTs that can be created with 4 distinct keys. So, we substitute n = 4 into the formula:
C(4) = (2 * 4)! / ((4 + 1)! * 4!)
= 8! / (5! * 4!)
= (8 * 7 * 6 * 5!) / (5! * 4!)
= 8 * 7 * 6
= 336
However, this result includes all possible binary trees with 4 nodes, not just the distinct BSTs. The question specifically asks for the number of distinct BSTs.
To obtain the number of distinct BSTs, we need to divide the result by the number of possible arrangements of the same keys in a binary tree structure. For 4 distinct keys, there are 4! = 4 factorial = 4 * 3 * 2 * 1 = 24 possible arrangements.
Therefore, the number of distinct BSTs that can be created out of 4 distinct keys is:
336 / 24 = 14
So, the correct answer is option 'B' - 14.