426 views

1 Answer

0 votes
0 votes
We have to strict to structure of tree given.

So, First of all any one can be root so 9C1 ways

Now i m taking example of 1 as root(Rest will be 2,3,4,5,6,7,8,9)

So, Case-1 In left subtree of root 2,3,4 can only be there as per condition

These can be settled in 3! ways

and right subtree  can have 5,6,7,8,9

Now again choose one of 5 for to be root of right subtree of Orignal root

so 5C1 ways

Lets Say Root is 5

Now here again Left side can have either 6 or 9

so 2 ways...

Now Lets say it have 6 as Left Child..So  Right side will have 7,8,9.. SO 3! ways..

Case-2 When 7,8,9 will be at Left Side of 1..

Same story will repeat..

So for 1 as a root we got 2*3!*5C1*2*3!=720

Now we can have 9 different roots so 9c1*720=6480

Related questions

2 votes
2 votes
1 answer
1
radha gogia asked Dec 10, 2015
1,680 views
If I have n elements in the heap then why does the index of leaf nodes ranges from index ⌊n/2⌋+1 to index n ?
1 votes
1 votes
1 answer
3
iarnav asked May 21, 2017
597 views
Hello may someone tell me what trees need to be studied in Data Structures subject.
0 votes
0 votes
3 answers
4
smartmeet asked Feb 8, 2017
7,073 views
If a node in a BST has two children, then its in-order predecessor hasa) No left childb) No right childc) 2 childrend) no child