典型递归算法例子-------Python实现
摘要:
#!/usr/bin/python
#coding=utf-8
'''
Created on 2012-9-25 @author: linzuxin
''' status = {} def factorial(n): ''' 输入一个数字,求其阶乘。status是一个hash,用来存储中间结果,避免重复计算 @param n: 要求的数字 @return: n的阶乘 ''' if n == 0 or n == 1: status[0] = 1 status[1] = 1 re... 阅读全文
posted @ 2012-09-26 16:56 linzuxin 阅读(266) 评论(0) 推荐(0) 编辑