Count trees formed of n nodes

If there are n nodes given ,how many structurally different binary trees can be formed.
Note: You don't have to create trees out of n nodes given ,this is a counting problem.

Comments

  1. N! (n factorial ) binary trees are possible.

    ReplyDelete
  2. @gaurav i need someone to write code for this.

    ReplyDelete
  3. shouldn't it be
    (nC1).1! + (nC2).2! + (nC3).3!.....(nCn).n!
    and additional +1 for null tree.

    ReplyDelete
  4. @harpal your count may be correct but can you please write working code for this..

    ReplyDelete
  5. @harpal: your ans is wrong

    its a series :

    1{for null tree} + 1.n + 2.(n - 1) + 3.(n - 2) + ... n.(n - (n - 1))

    ReplyDelete

Post a Comment

Popular posts from this blog