Hard Interview Problem

Revision en2, by Romok007, 2019-11-22 10:00:48

Hi Everyone, I am stuck in an interview problem and not finding any resources on the internet which can help me find a solution, if you provide an idea about the solution it will be of great help. The problem is as follows :

Generate a random binary search tree of 'n' nodes with equal probability.

For example : if n = 3 there are 5 possible binary search trees, our program should return any one tree with equal probability (i.e. 1/5).

Tags #help, #interviews, #trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Romok007 2019-11-22 10:00:48 5 Tiny change: 'ry search of 'n' no' -> 'ry search tree of 'n' no'
en1 English Romok007 2019-11-21 19:22:51 472 Initial revision (published)