请注意broker是尾递归的。
b当一个方法是递归的时候。
举出一个你所用过的递归的例子。
Can you name an example of a recursive solution that you created?
这就是我们使用递归的原因。
如果使用子程序的话,它不能是递归的。
还要注意向左递归的使用。
迭代的是人,递归的是神。
递归的另一个实例如下。
这是递归的停止条件。
注意递归的使用,避免完全while循环。
问题在于,我们能否在不使用递归的前提下实现访问者模式?
The question is, can we implement the Visitor pattern without recursion?
为了支持这一特性Jigsaw有一个本地依赖的概念,该概念是递归的。
To support this Jigsaw has a concept of a local dependency which is recursive.
在前面两个例子里,每一部问题的规模缩小了,不管是迭代的还是递归的,这表明这个问题的复杂性可能是线性的。
In the first two cases, the problem reduced by 1 at each step.
例如,考虑在一个递归方法中会发生的事情。
Consider what would happen with a recursive method, for instance.
要了解其中的递归逻辑,请参阅存档的源文件。
To understand this recursive logic, check out the documented source file.
可以证明,这种递归解法需要耗费指数级的时间。
It can be shown that this recursive solution takes exponential time to run.
对更复杂的递归过程来说这是一个通用的模式。
This is a common pattern for more complex recursive procedures.
我们的下一个基于列表的递归函数示例要稍微复杂一些。
Our next example of a recursive function on lists will be a little more complicated.
这就是一个绝妙的递归定义。
请注意传统的递归首字母缩写。
将一个常见的循环转化为递归函数。
例如,概念模型可能显示从Person到它本身的一个简单的递归关系。
For example, the conceptual model may show a simple recursive relationship from Person to itself.
然后在这里有个这样的数列,一个很好的用递归来实现的斐波那契i数列。
And so we've got it up here, a nice little recursive implementation of it.
递归方法也需要显式的返回类型。
向左递归更有效,而且对较大的输入集来说,这可能是惟一可行的选择。
Left-recursion is more efficient and, for large input sets, may be the only viable option.
更严重的问题是类定义中可能存在多态递归。
The more serious problem is the potential for polymorphic recursion in class definitions.
相似的问题还包括过多的递归。
另一个重要的概念是递归。
在此,我们继续讨论归纳数据集的递归。
In the meantime, let's continue our discussion of recursing of inductive data sets.
我们要寻找它递归所以最后一个参数应该是真实的。
We want to look for it recursively so the the last argument should be true.
应用推荐