Monday 15 September 2014

Number of bst


Number of binary search tree having n vertices


   (2n)!/(n!*(n+1)!)
   which is equals to the nth CATALAN number
    CATALAN  series
    1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845,                 35357670, 129644790,477638700, 1767263190, 6564120420, 24466267020, 91482563640,               343059613650, 1289904147324, 4861946401452..........

    Recurrence relation for catalan series..

   c(0)=1;
   c(n+1)=sigma(c(i)*c(n-i)) over i=0 to n.

No comments:

Post a Comment