【发布时间】:2013-09-29 15:49:30
【问题描述】:
def count(n):
if n == 0 or n == 1:
return 1
else:
sum = 0
left = 0
right = 0
for x in range(1,n+1):
left = count(x-1)
right = count(n-x)
sum += left * right
return sum
我正在阅读这篇文章,我想知道 如果 n 个节点中没有不同的二叉搜索树是
(2n)! / ((n+1)! * n!)
来自 this 帖子。
然后
- 时间复杂度是多少?在!) ?
- 什么是递归关系?
【问题讨论】:
标签: python algorithm binary-tree complexity-theory time-complexity