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 ? | 148 Yes | 22 No |
Post New Answer View All Answers
How do treesets work internally?
What does isempty() member method determines?
Explain the Complete structure of hashmap along with the basic coding of the hashmap internal implementation.
Why use a tuple instead of a list?
What is ascii sort order?
What is collision in data structure?
What is hashing technique? Describe in brief.
Define collision in hashing?
How is the front of the queue calculated ?
Is array static or dynamic?
What are different types of sorting techniques?
How many types of searching are there in data structure?
How do you find the time complexity of a bubble sort?
What is a stable algorithm?
What is a matrix?