Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:这道题应该是要用递归来算吧???

Posted by clockwise at 2006-09-05 22:00:57 on Problem 2775
In Reply To:这道题应该是要用递归来算吧??? Posted by:chying at 2006-03-26 16:53:21
> 这道题应该是要用递归来算吧??? 不知可以不构造二叉树,然后不断的生成左右子串来处理。。。

可以的。

nodes(bst): 树的节点个数。
x(bst) : 表示我们要求的答案。
C(m, n): 组合数。

x(bst) = x(bst->leftChild) * x(bst->rightChild) * C(nodes(bst) -1, nodes(bst->leftChild))
x(empty tree) = 1

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator