How many different binary trees and binary search trees can
be made from three nodes that contain the key values 1, 2 & 3?

Answers were Sorted based on User's Feedback



How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / hazrat hussain

Formula For BST is
{(2n)!/(n!*n)}/(n+1)
So for
N=1 BST=1
N=2 BST=2
N=3 BST=5
N=4 BST=14
N=5 BST=42
and so on

Is This Answer Correct ?    1 Yes 0 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / anonymous

30 binary trees 10 for each 1,2 and 3.
only 1 binary search tree as with 2 as root node 1 as right child and 3 as left child.

Is This Answer Correct ?    0 Yes 0 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / rohit

binary tree = n!(2^n - n).
for n =3 its 30.

for BST its 2n
C * [1/(n+1)]
n
for n=3 its 5.

Is This Answer Correct ?    1 Yes 1 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / mann

binary seach tree will be one withh 2as root node
and 1 as left child and 3 as right child of root(2).

Is This Answer Correct ?    0 Yes 1 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / tarun

2n c n/(n+1)

Is This Answer Correct ?    2 Yes 4 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / mousumi

binary search tree = 5

1 1 2 3 3
\ \ / \ / /
2 3 1 3 1 2
\ / \ /
3 2 2 1

binary tees = (2^3)-3=5

Is This Answer Correct ?    4 Yes 6 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / moru laxmi narayana

18 binary trees,5 binary search trees

Is This Answer Correct ?    1 Yes 3 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / gurwinder

no.of binary trees=n!*(2^(n)-n)
no.of bst's=n*[2^(n)-n]

if 1,2,3 are key nodes
then:
no. of BST=15
no. of binary trees= 30

Is This Answer Correct ?    2 Yes 4 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / shalini

binary search tree=(2^n)-n i.e (2^3)-3=5
binary tree=((2^n)-n)*n! i.e ((2^3)-3)*3!=30


this is the right answer!!!!

Is This Answer Correct ?    2 Yes 4 No

How many different binary trees and binary search trees can be made from three nodes that contain t..

Answer / unknown

30,6

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Data Structures Interview Questions

What does quick sort do?

0 Answers  


Is map a collection?

0 Answers  


What are binary trees?

0 Answers  


By Which algorithm, the 8 queens problem is solved?

0 Answers  


Can a binary tree be empty?

0 Answers  






Why null is not allowed in treemap?

0 Answers  


What do you mean by probing?

0 Answers  


What are the major data structures used in the rdbms?

0 Answers  


What is hashing in cyber security?

0 Answers  


What is a property class?

0 Answers  


What are different techniques for making hash function?

0 Answers  


What are the different types of sorting? Explain the difference between them.

0 Answers   TCS,


Categories