【发布时间】:2013-05-05 21:42:42
【问题描述】:
可能重复:
Are there problems that cannot be written using tail recursion?
据我了解,尾递归是一种优化,当递归调用不需要来自递归调用的信息时,您可以使用它会产生垃圾邮件。
那么是否可以使用尾递归来实现所有递归函数?像 DFS 这样的东西,你需要最里面的孩子在父母之前返回?
【问题讨论】:
标签: algorithm recursion tail-recursion