Davinder Singh - 4 years ago in Data Structure

The number of possible ordered trees with three nodes A,B,C is?

[A] 16
[B] 12
[C] 6
[D] 10

Overall Stats

Attempted 435
Correct 65
Incorrect 115
Viewed 255

Ag Arpit Gupta - 1 year ago

How to solve it

• Vikas Sharma - 1 year ago

since it is about all possibilities having all three nodes there are 12 such ordered tree 6 are binary and 6 are skewed trees

• Rupendrasingh Krishna - 2 years ago

(2ncn/(n+1)) * n! n =no of nodes so substitute n=3 answer is 30 .But there is no option 30

• Subhajyoti Majumdar - 2 years ago

This is simple. At 1st split the problem into two parts - A) Tree with 3 nodes i.e root node has two children & B) Tree with 2 nodes i.e root has one child. Now consider case 'A'. Here look root node is fixed and remaining two child nodes are able to interchange their positions. As example Let A is root node and B,C are child nodes. Now B can be left child & C can be right child. Alternatively B can be right and C can be left. So they can interchange their positions in 2! ways. Similarly If we consider B as root then we get another 2! and in case of C as root got another 2!. So from case 'A' we got total 2!+2!+2! = 6 number of distinct ordered trees. Now lets go to case 'B'. Here it's all about root and exactly one child i.e just 2 nodes. So here the node combinations are A-B,B-C,C-A & like the case 'A' for A-B we got 2!, for B-C: 2! & for C-A: 2!. So in case 'B' also total 2!+2!+2! = 6 number of distinct ordered trees. Now we have come to the final part. If you look carefully, then you find that case 'A' & 'B' are non-overlapping cases as we consider distinct suit of conditions for each case respectively. So now simply add the results we got from case 'A' & 'B' i.e 6+6 = 12. Therefore, we can conclude now by our final result as 12. :) :)

• KESHAV SAINI - 2 years ago

HOW TO SOLVE IT

• Related Questions

Davinder Singh - 4 years ago in Data Structure
The postfix expression for * + a b - c d is?
• [A] ab + cd - *
• [B] ab cd + - *
• [C] ab + cd * -
• [D] ab + - cd *
Davinder Singh - 4 years ago in Data Structure
The initial configuration of the queue is a,b,c,d (a is the front end). To get the configuration d,c,b,a one needs a minimum of ?
• [A] 2 deletions and 3 additions
• [B] 3 additions and 2 deletions
• [C] 3 deletions and 3 additions
• [D] 3 deletions and 4 additions