ISRO | ISRO CS 2011 | Question 11
How many distinct binary search trees can be created out of 4 distinct keys?
(A)
5
(B)
14
(C)
24
(D)
35
Answer: (B)
Explanation:
Distinct binary search trees that can be created out of 4 distinct keys can be found out using the Catalan number.
Catalan number = (2n)!/(n! * (n+1)!)
Here n = 4,
Number of distinct BST\’s = (4 x 2)! / (4! x 5!) = 14
So, correct option is (B)
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...