您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

递归小程序实例代码

2024/8/22 1:35:18发布41次查看
这篇文章介绍递归小程序示例代码
# -*- coding:utf-8 -*-   __author__ = 'abel xu'     def func(n):          t(n) = 4t(n/2)+n     = 2n^2-n     :param n:     :return:          if n==0:         return 0       return 4 * func(n/2) + n   # 另一套写法 f = lambda x: x and 4*f(x/2)+x or 0   if __name__ == '__main__':       for i in xrange(0, 6, 2):         print(func(i))       print f(4)
以上就是递归小程序实例代码的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product