549 views
1 votes
1 votes
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 votes
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)...

Related questions

0 votes
0 votes
1 answer
1
once_2019 asked Jun 24, 2018
631 views
Is the root node an internal node?
0 votes
0 votes
3 answers
2
smartmeet asked Feb 8, 2017
6,986 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 votes
–4 votes
2 answers
3
Souvik33 asked Oct 27, 2022
636 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 votes
1 votes
1 answer
4
rahul sharma 5 asked Apr 12, 2018
695 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...