Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:这道题应该是要用递归来算吧???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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator