How many different binary trees and binary search trees can
be made from three nodes that contain the key values 1, 2 & 3?
Answer Posted / shweta
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
5*6=30
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
| Is This Answer Correct ? | 19 Yes | 42 No |
Post New Answer View All Answers
Is an arraylist a vector?
What are the operations that can be performed on a stack?
What is meant by binary tree?
What are hashmaps good for?
Define balanced trees?
Why do we use dynamic arrays?
what is the difference between Linear Array and Linked List?
What do you mean by shortest path?
Can treemap have null values?
What is storage structure in data structure?
Can we remove element from arraylist while iterating?
Define non-terminal nodes in a tree?
Define level of the tree?
What is entryset method in map?
Explain Array of pointers?