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 / aisha
Binary tree :- 30 as follows
1 1 2 2 3 3
/ \ / \ / \ / \ / \ / \
2 3 3 2 1 3 3 1 1 2 2 1
1 1 1 1 1 1 1 1
/ / / / \ \ \ \
2 3 2 3 2 3 2 3
/ / \ \ / / \ \
3 2 3 2 3 2 3 2
2 2 2 2 2 2 2 2
/ / / / \ \ \ \
1 3 1 3 1 3 1 3
/ / \ \ / / \ \
3 1 3 1 3 1 3 1
3 3 3 3 3 3 3 3
/ / / / \ \ \ \
2 1 2 1 2 1 2 1
/ / \ \ / / \ \
1 2 1 2 1 2 1 2
Binary search tree :-5 as follows
1 1 2 3 3
\ \ / \ / /
2 3 1 3 1 2
\ / \ /
3 2 2 1
| Is This Answer Correct ? | 149 Yes | 22 No |
Post New Answer View All Answers
What is difference between hashtable and hashmap?
What does stack top do?
Parenthesis is never required in postfix or prefix expressions, why?
How is the front of the queue calculated in data structure?
Does arraylist contain duplicates?
What do you mean by selection sort?
How can I search for data in a linked list?
What is an acyclic graph?
Can we extend an array after initialization?
What is ds heap sort?
What is difference between treeset hashset linkedhashset?
Does treeset remove duplicates?
What is a pass in bubble sort?
Can you dynamically allocate arrays in expanded memory?
Is list an array?