所有的迭代算法都可以递归表达吗?

编程入门 行业动态 更新时间:2024-10-11 05:21:17
本文介绍了所有的迭代算法都可以递归表达吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果没有,是否有一个很好的反例来说明不存在递归对应的迭代算法?

If not, is there a good counter example that shows an iterative algorithm for which there exists no recursive counterpart?

如果是所有迭代算法都可以递归表示的情况,有没有更难做到的情况?

If it is the case that all iterative algorithms can be expressed recursively, are there cases in which this is more difficult to do?

另外,编程语言在这一切中扮演什么角色?我可以想象,与纯 Java 程序员相比,Scheme 程序员对迭代(=尾递归)和堆栈使用有不同的看法.

Also, what role does the programming language play in all this? I can imagine that Scheme programmers have a different take on iteration (= tail-recursion) and stack usage than Java-only programmers.

推荐答案

对此有一个简单的临时证明.由于您可以使用严格的迭代结构构建图灵完备语言,而仅使用递归结构构建图灵完备语言,因此两者是等价的.

There's a simple ad hoc proof for this. Since you can build a Turing complete language using strictly iterative structures and a Turing complete language using only recursive structures, then the two are therefore equivalent.

更多推荐

所有的迭代算法都可以递归表达吗?

本文发布于:2023-11-29 18:43:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:递归   算法   迭代

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!