Math, asked by abhijeet703, 1 year ago

Program to count the number of possible binary search trees with n keys

Answers

Answered by Ayush4722
0

Answer:

Step-by-step explanation

Total number of possible Binary Search Trees with n different keys (countBST(n)) = Catalan number Cn = (2n)! / ((n + 1)! * n!)

For n = 0, 1, 2, 3, … values of Catalan numbers are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, …. So are numbers of Binary Search Trees.

Total number of possible Binary Trees with n different keys (countBT(n)) = countBST(n) * n!

Similar questions