• edited by
1,545 views
2 2 votes

The number of binary search trees with 2n+1 keys where median is the root?

  1. $(\frac{2nc_n}{n+1})^2$
  2. $(n!)^2$
  3. $(2n+1)!$
  4. it depends on the values of the keys

1 Answer

Best answer
3 3 votes
Since 2n+1 key sare given .

Median is middile element of sorted sequence.

so if if root is median then left of subtree n nodes are there and right also n nodes are there of median element.

so for left side  with n element how many BST are possible = $\frac{\binom{2n}{n}}{n+1}$

so for right side  with n element how many BST are possible = $\frac{\binom{2n}{n}}{n+1}$

total BST are = $\frac{\binom{2n}{n}}{n+1} \times \frac{\binom{2n}{n}}{n+1} = \left (\frac{\binom{2n}{n}}{n+1} \right )^2$
• selected by
Position:
Show:

Related questions

1 1 vote
0 0 answers
309
309 views
Anil Khatri asked Aug 28, 2016
309 views