How many different binary trees and binary search trees can
be made from three nodes that contain the key values 1, 2 & 3?
Question Submitted By :: Data-Structures
I also faced this Question!! Answer Posted By
If the element is a root node ,in a 1st search it will find
the element. If the element is either a lchild or rchild it
make 2 searches. Kalai
Not a direct answer. But you can find in depth concepts
about binary and binary search tree in this page.
30 binary trees
14 binary search trees Bittu Sarkar
for no. of different binary tree---
for n nodes the formula is 2^n-n in this formula value of
nodes are not considered, only the way nodes can be present
in a tree so for 3 nodes there can be 5 ways, for each way
no. of possibilty of values is 3! so answer comes out to be
1 1 1 1 1
A A A A A
2 3 2 2 2 2
A A A A
3 3 3 3
for binary search tree answer is 3 Shweta
12 binary trees
3 binary search trees Hash Define
for binary tree answer is n! ways that is 3!=6
For Binary search tree n ways..that is 3 Kanha
18 Binary trees and 3 Binary serach trees.
one binary search tree and 9 binary trees.