285 views
1 votes
1 votes

Observe the unlabelled binary tree given below.
image:PDSSub7a.PNG

The number of ways of inserting the values 1 ,2,3,4,5,6 in a Binary Search Tree such that the resultant BST takes the structure of the Binary tree given above ?

2 Answers

0 votes
0 votes

we have to take one value at root node

and two value needed at left sub tree which is less than the value of root node

and three value needed at right sub tree which is greater than the value of root node

so for this only possibility is take to 3 as a root node

so only one way possible,,,,correct me if wrong 

edited by
0 votes
0 votes
As we know in binary tree order is not important , so in binary tree as structure is given there is only one way to put node in BST.

It is a balanced binary tree. So, structure will be

                     3

                   /    \

                1         5

                  \       /    \

                   2    4      6

and complexity of this binary tree will be O(n)

No related questions found