InterviewSolution
| 1. |
Let T(n) be the number of different binary search trees on n distinct elements.Then , where x is(A) n-k+1(B) n-k(C) n-k-1(D) n-k-2 |
|
Answer» Answer: (B) Explanation: The idea is to make a key root, put (k-1) keys in one subtree and remaining n-k keys in other subtree. A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −
Now construction binary search trees from n distinct number- If n=3 We have 5 possibilities. Keeping each number first as root and then arranging the remaining 2 numbers as in case of n=2. |
|