48 votes 48 votes We are given a set of $n$ distinct elements and an unlabeled binary tree with $n$ nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree? $0$ $1$ $n!$ $\frac{1} {n+1} .^{2n}C_n$ DS gatecse-2011 binary-tree normal + – go_editor asked Sep 29, 2014 • recategorized Aug 24, 2017 by srestha go_editor 31.9k views answer comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments Manish Kumar Tiwari commented Nov 18, 2017 reply Follow Share if it is given a labeled binary tree with n nodes then??? 0 votes 0 votes Sambhrant Maurya commented Jul 23, 2019 reply Follow Share @Manish Kumar Tiwari Labeled binary tree implies that the elements are already fixed. You can't change their arrangement. So only 1 possibility. 0 votes 0 votes Ray Tomlinson commented Jan 9 reply Follow Share Video solution 0 votes 0 votes Please log in or register to add a comment.
–3 votes –3 votes Ans is D Pranay Datta 1 answered Aug 31, 2015 Pranay Datta 1 comment Share Follow See all 3 Comments See all 3 3 Comments reply Arjun commented Sep 1, 2015 reply Follow Share Structure is fixed here. So, we can have only 1 way of filling as elements are distinct. http://gatecse.in/wiki/Number_of_Binary_trees_possible_with_n_distinct_nodes 0 votes 0 votes Pranay Datta 1 commented Sep 1, 2015 reply Follow Share yes as the elements are distinct so for each structure only one order is possible . 0 votes 0 votes shekhar chauhan commented Jul 2, 2016 reply Follow Share Can you please explain what is wrong in my answer ? 0 votes 0 votes Please log in or register to add a comment.