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
What are the major data structures used in the following areas : network data model & hierarchical data model?
Can treeset contain null?
What is the types of data structure?
Explain merge sort algorithms.
Which is better stack or queue?
What is list and types of list?
Does linkedhashset allow duplicates?
Can an arraylist be null?
Difference between hashset and treeset?
What is meant by ordered and sorted in collections?
Write a program to reverse a link list.
Which sorting is stable?
What type of algorithm is binary search?
What is a spanning tree in data structure?
What is the difference between arraylist and array?