759 views
1 1 vote
Q-We are given set of n distinct elements and an unlabled binary tree with  n nodes how many ways we can populate the tree with given set so that it becomes binary search tree ?

1 Answer

0 0 votes
1 way..

perform in order traversal of that unlabeled tree...as the nodes are traversed, assign them with elements in increasing order(since BST inorder is ascending)...
Position:
Show:

Related questions

0 0 votes
1 1 answer
1.1k
1.1k views
once_2019 asked Jun 24, 2018
1,106 views
Is the root node an internal node?
0 0 votes
3 3 answers
9.3k
9.3k views
smartmeet asked Feb 8, 2017
9,263 views
If a node in a BST has two children, then its in-order predecessor hasa) No left childb) No right childc) 2 childrend) no child
–4 –4 votes
2 answers 2 answers
1.7k
1.7k views
Souvik33 asked Oct 27, 2022
1,718 views
*MSQ*The following figure depicts a a. A tree and only treeb. A tree with 3 nodesc. A graph (Since every tree is a graph)d. A graph and only graph
1 1 vote
1 1 answer
1.6k
1.6k views
rahul sharma 5 asked Apr 12, 2018
1,640 views
a:) If given Tree is BST = Inorder of keys is sortedb:) Inorder of keys is sorted = Tree is BST(converse of above)I know first one holds.Is second one also true?If not ca...