每一个递归程序都遵循相同的基本步骤。
Every recursive program follows the same basic sequence of steps.
计算阶乘是递归程序设计的一个经典示例。
The classic example of recursive programming involves computing factorials.
有时候,编写递归程序时难以获得更简单的子问题。
Sometimes when writing recursive programs, finding the simpler sub-problem can be tricky.
在这个程序中,所有状态改变都是通过使用完全前后一致的数据重新运行递归程序而实现的。
In this program, all state changes are brought about by re-running the recursive function with completely self-consistent data.
注意,与我们的递归程序非常类似,链表的定义也包括一个基线条件 ——在这里是NULL指针。
Notice how like our recursive programs, the definition of a linked list also contains a base case -- in this case, the NULL pointer.
本文介绍了计算机系统将递归程序转换为非递归程序的方法,并举例说明如何手工应用。
This article introduces how the computer system transforms recurrence programs into non-recurrence programs, and gives two examples showing how to make use of it.
不过,随着程序越来越复杂,递归程序设计能够让程序员以可维护且逻辑一致的方式更好地组织代码。
But as programs become more complex, recursive programming gives the programmer a better way of organizing code in a way that is both maintainable and logically consistent.
注意,与我们的递归程序非常类似,链表的定义也包括一个基线条件——在这里是NULL指针。
Notice how like our recursive programs, the definition of a linked list also contains a base case — in this case, the NULL pointer.
由于NULL指针会结束一个链表,所以我们也可以使用 NULL 指针条件作为基于链表的很多递归程序的基线条件。
Since a NULL pointer terminates a list, we can also use the NULL pointer condition as a base case for many of our recursive functions on linked lists.
讨论了递归程序设计的公式化方法,指出现有方法的不足,并提出了一种新的基于求解状态的递归程序设计公式化方法,在一定程度上达到了递归程序设计公式化、简单化的目的。
Formula method of recursive programming is discussed. The imperfectness of the present method is pointed out, and a new formula method of recursive programming based on solving state is proposed.
讨论了递归程序设计的公式化方法,指出现有方法的不足,并提出了一种新的基于求解状态的递归程序设计公式化方法,在一定程度上达到了递归程序设计公式化、简单化的目的。
Formula method of recursive programming is discussed. The imperfectness of the present method is pointed out, and a new formula method of recursive programming based on solving state is proposed.
应用推荐