5 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
Loading...
Next Question

Overall Stats

Attempted 510
Correct 91
Incorrect 148
Viewed 271

Answers

Guest
Guest
Ag Arpit Gupta - 2 years ago

How to solve it

Vikas Sharma - 3 years 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 - 3 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 - 3 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 - 4 years ago

HOW TO SOLVE IT

Related Questions

Linked list are not suitable data structure of which one of the following problems ?

  • [A] Insertion sort
  • [B] Binary search
  • [C] Radix sort
  • [D] Polynomial manipulation

Which of the following algorithm design technique is used in the quick sort algorithm?

  • [A] Dynamic programming
  • [B] Backtracking
  • [C] Divide and conquer
  • [D] Greedy method

A vertex of degree one is called

  • [A] padent
  • [B] isolated vertex
  • [C] null vertex
  • [D] colored vertex

Queue can be used to implement ?

  • [A] quick sort
  • [B] merge sort
  • [C] heap sort
  • [D] insertion sort