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
Why hashmap is faster than hashset?
What is meant by a dynamic array?
What are the four characteristics of algorithms?
What are the differences between b tree and b+ tree?
State the merits of linear representation of binary trees?
Explain the steps to insert data into a singly linked list?
What is a sorting algorithm in data structure?
Write an algorithm to show the postfix expression with the input given as : a b + c d +*f ? .
What is the impact of signed numbers on the memory?
Can we extend an array after initialization?
Is radix sort faster than quicksort?
Does hashmap allow duplicate keys?
What do you know about traversal in linked lists?
Where will be the free node available while inserting a new node in a linked list?
Is boolean a data type?