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

Correct Answer (Detailed Explanation is Below)

C. 14

Detailed Explanation

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 nn keys:

Cn=(2n)!(n+1)!n!C_n = \frac{(2n)!}{(n+1)! \, n!}

For n = 4:

C4=(8)!5!×4!=14C_4 = \frac{(8)!}{5! \times 4!} = 14

So, 14 different BSTs can be formed using 4 distinct keys.

OOps! You are currently offline.