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
How will you check the validity of an expression containing nested parentheses?
What are the different types of data structures?
How do you clear a stack?
What is data structure and its classification?
Name few concurrent collection classes?
What is sorting an array?
What are the types of bulleted list?
What is the best time complexity of bubble sort?
How to traverse data in a linked list in forward and backward direction, write the algorithm?
How does arraylist size work?
How to find if linked list has loop?
Can we use Generics with the array?
Can a tree be empty?
Is treemap thread safe?
Why do we need a data structure?