edited by
6,821 views
4 votes
4 votes
Let us there are n nodes which are labelled.

Then the number of trees possible is given by the Catalan Number i.e $\binom{2n}{n} / (n+1)$

Then the binary search trees possible is just $1$?
edited by

5 Answers

4 votes
4 votes
For example, if number of nodes are 3 then 5 unlabelled binary trees[2nCn/(n+1)] are possible with 3 nodes. So, for each unlabelled binary tree there are 6 possible labelled binary trees[(i.e.,n!,(3!=3*2*1)] . Suppose that 3 labelled nodes are 1,2,3 and inorder traversal for this labelled binary tree is 123, then among those 6 possible binary trees you can get only one binary search tree as inorder 123.
edited by
1 votes
1 votes
For a given unlabeled tree(ie structure of Binary tree is not fixed) we can have [2nCn/(n+1)] structures,

For no of nodes= 3

no of structure= 5

now for each binary tree structure  we can arrange n values in n! ways..but all will not be binary search tree.

To make them a binary search tree there is only one fix order of n values. That's why for each structure we have n! binary tree but only 1 Binary search tree..

So for n= 3 (in case of unlabeled)

Total binary tree possible= 5*3! = 30

Total binary search tree possible= 5*1= 5
0 votes
0 votes
According to given in CLRS the total number of Binary Search tree is itself the catalan number

(2n C n) /(n+1)

Related questions

0 votes
0 votes
0 answers
1
0 votes
0 votes
1 answer
2
Anish Palan asked Dec 18, 2017
731 views
Given an initially empty Binary search tree how many different order of insertion order A,B,C,D,E,F,G that returns minimum height tree?
0 votes
0 votes
1 answer
3
0 votes
0 votes
2 answers
4
Tushar Shinde asked Jan 15, 2016
951 views
I am stuck after JAN. It is not getting balanced even after 2 rotations. Can somebody help?