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 the difference between 1d and 2d array?
Write an algorithm through which the inserting and deleting of elements can take place in circular queue?
What is bubble sort and selection sort?
How do you find the size of an arraylist?
Difference between abstract data type, data type and data structure?
Define a linear and non linear data structure.
Which time complexity is best?
What are the advantage of linked list over array?
Write the advantage of separate chaining?
What is mean by merge sort?
Which is faster binary or linear search?
How can you add an item to the beginning of the list?
What is adt in data structure with example?
Explain the term base case?
What are the advantages of linked list over an array?