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
Explain recursive function & what is the data structures used to perform recursion?
Can you please explain the difference between array_name and &array_name?
Which is the parent class of deque
How do we search a specific element in an array?
What is heap tree explain with example?
What is hashing in cyber security?
Differentiate linear from a nonlinear data structure?
What is doubly linked list in data structure?
Explain about circular linked list?
In what order the elements of a hashset are retrieved?
What is bubble sort?
How does dynamic memory allocation help in managing data?
Difference between arrays and linked list?
Which sorting technique is best in worst case?
How do I sort hashset?