DATA STRUCTURE
Programming and Technical
Programming
Technical
Number of possible ordered trees with 3 nodes A, B, C is
Option 1 : 16
Option 2 : 12
Option 3 : 13
Option 4 : 14
Read Solution (Total 7)
-
- option 2 : 12
for each node we can make 4 order.. so total 3*(4 for each)=12 - 9 years agoHelpfull: Yes(9) No(6)
- i think answr is 6 as
a
/
b c
a
/
c b
b
/
a c
b
/
c a
c
/
a b
c
/
b a - 9 years agoHelpfull: Yes(4) No(5)
- It is 12. The tree may be of depth 2 or 1. if the depth is 2, we have 6 possible trees. This is because one of the three nodes A, B, C may be the root and the next level may be one of the remaining two nodes. If the depth is 1, the root may be one of the 3 nodes A, B, C. Corresponding to a root, say A, two trees as possible as this.
- 8 years agoHelpfull: Yes(1) No(0)
- option 2 :12
as there are 3 node
so possible cases are : 2 i.e. height are 2 and 1 for tree
CASE 1
when making tree of height 2 then
for root node we have 3 options node A B C (supposed we use A)
for node at height 1 we have 2 option B C (supposed we use B)
for node at height 2 we have 1 option C
SO THIS TURNS OUT TO BE 3 *2*1= 6 trees (using permutation)
CASE 2
possible trees with height 1 are as follow
a
/
b c
a
/
c b
b
/
a c
b
/
c a
c
/
a b
c
/
b a
here 6 trees
adding case 1 and case 2 = 6+6 =12 trees is ans - 7 years agoHelpfull: Yes(1) No(0)
- I think n * n-1
so,(3) * (3-1) = 3*2 = 6 - 8 years agoHelpfull: Yes(0) No(2)
- It is 12. The tree may be of depth 2 or 1. if the depth is 2, we have 6 possible trees. This is because one of the three nodes A, B, C may be the root and the next level may be one of the remaining two nodes. If the depth is 1, the root may be one of the 3 nodes A, B, C. Corresponding to a root, say A, two trees as possible as this.
- 7 years agoHelpfull: Yes(0) No(0)
- solution=3*(3+1)=12
Option:2 - 6 years agoHelpfull: Yes(0) No(1)
DATA STRUCTURE Other Question