标签:code nod class next node ext ret recursion print
递归都可以用循环实现,反之不一定
# !< eg:
def count(n):
for i in range(n):
print(i)
def count_re(n):
if n > 1:
count_re(n-1)
print(n-1)
count_re(10)
def fib(n):
if n == 1:
return 1
if n == 2:
return 1
return fib(n - 1) + fib(n - 2)
print(fib(3))
def add(self, v):
if self.next is not None:
return self.next.add(v)
self.v = Node(v)
标签:code nod class next node ext ret recursion print
原文地址:https://www.cnblogs.com/xuzhaoping/p/11488574.html