任何可以用递归实现的算法都可以用迭代实现。
Any algorithm that can be implemented using recursion can also be implemented using iteration.
给出了适合于计算机处理的离散递归实现步骤。
A discrete iterated procedure, which can be processed conveniently by a computer, is discussed.
易语言漫水法递归实现源码例程程序演示了递归方法的漫水法填充效果。
Easy language routines source diffuse recursive method demonstrates the recursive method of flood fill effect.
利用递归和非递归实现二叉树的中序遍历,利用队列实现二叉树的层次遍历。
Recursive and non recursive implementation of binary tree traversal, the use of queues to achieve the level of binary tree traversal.
复杂算法通常比较容易使用递归实现。事实上,有些传统算法正是以递归实现的,诸如阶乘函数。
Complex algorithms are typically made easier by using recursion. In fact, there are some traditional algorithms that presume recursion as the implementation, such as a function to return factorials.
清单2中的实现所需的时间比清单1短许多,清单2的运行时间为O (n),而清单1中的递归实现的运行时间是n的指数。
Listing 2's implementation runs in o (n) time. I won't prove this, but the running time of Listing 1's naive, recursive implementation is exponential in n.
递归允许在域的更高层定义策略,然后将它们强制到内部所有组件实现和交互。
Recursion allows defining policies higher up in a domain and enforce them on all the component implementations and interactions within.
为了测试这段初步的日志记录代码,我将使用一个精巧的递归方法,它是斐波纳契数列计算的一个实现,如清单4 所示。
To test this preliminary logging code, I'll use a nicely recursive method, an implementation of the Fibonacci sequence calculation, as shown in Listing 4.
在访问者实现中可以清楚地看到这一点,您可以看到对eval - concat函数的所有递归调用。
This is obvious in the Visitor implementation where you see all of the recursive calls to the eval-concat function.
这种遍历非常有趣,因为它是迭代的,而不是递归的,这是zippers 遍历与之前的 clojure.walk实现之间的主要差别。
This traversal is interesting because it is iterative, not recursive, which is a key difference between zipper traversal and the prior clojure.walk implementation.
这也解释了函数执行的递归是如何实现的。
It also demonstrates how the recursion of the function execution works.
用递归方法对这些递归关系的直接实现会造成解决方案效率低下,因为其中包含了对子问题的多次计算。
The naive implementation of this recurrence relation as a recursive method would have led to an inefficient solution involving multiple computations of subproblems.
BPEL4WS允许您递归地组合结构化活动,以表达任意复杂的算法,这些算法表示了服务的实现。
BPEL4WS allows you to recursively combine the structured activities to express arbitrarily complex algorithms that represent the implementation of the service.
目前的实现提供一个服务,可以递归地调用TCS来建立其自己的事务。
The current implementation provides for a service to recursively call the TCS to set up its own transaction.
在这个程序中,所有状态改变都是通过使用完全前后一致的数据重新运行递归程序而实现的。
In this program, all state changes are brought about by re-running the recursive function with completely self-consistent data.
通过增加简明的语法和支持,函数式语言使递归成为实现简单代码重用的候选方法。
By adding clean syntax and support, functional languages make recursion a candidate for simple code reuse.
处理器实现了一种递归算法。
我们稍后会去,看它的变量,它的所谓的递归数的变量,但是现在我得先讲讲,怎么来实现迭代。
We're going to see variations of this, we're going to see a variation of it called recursion, a little later on, but for now we're just going to talk about how do we do iterations.
第 5章介绍了划分问题、递归函数到迭代函数的转换(我可以向您保证,这非常有趣)以及阶乘和斐波纳级数的实现。
Chapter 5 deals with partitioning problems, converting recursive functions to iterative functions (it's fun, I assure you), and more factorial and Fibonacci series implementations.
您已经在Lisp中实现了递归函数。
nose测试运行器采用的实现方式介于另两种工具之间:它向下递归地搜索每个Python包,但是只检查目录名中包含单词test 的目录。
The nose test runner implements a middle way between the other two tools: it descends into every Python package, but is only willing to examine directories, if they have the word test in their name.
通常,函数语言会避开while循环,因为while实现的大多数操作都可以使用递归来完成。
Normally, functional languages eschew the while loop, because most of what while does can be done instead with recursion.
这在fork-join问题实现中很常见,因为递归分解问题的过程将会创建大量的新Problem对象。
This is typical of fork-join problem implementations because the process of recursively dividing the problem will create a potentially large number of new Problem objects.
注意,在循环的结尾处,我用一个比上次大1的参数递归地调用同一个函数,以实现循环的迭代。
Note at the end of the loop that I recursively call the same function with an argument that is one greater than the previous, implementing the iteration of the loop.
让我们完善脚本,实现递归访问子目录并处理包含需要上载文件的目录在远程服务器不存在的情况。
Let's finish up our script by descending into subdirectories and handling the situation where the directory containing the file being transferred may not exist on the remote server.
为了实现递归,可以通过将proceed(. .)调用封装在匿名类中来隐藏连接点的其他部分。
To do this recursively, you close over the rest of the join point by encapsulating the proceed (..) call in an anonymous class.
要实现这一转换,需要使用常用的被称为尾递归(tail recursion)的XSLT技术。
To effect that transformation, you need to use a common XSLT technique known as tail recursion.
接下来,要实现与递归算法中递归子问题对应的情景,但这时使用的是表格中已经填充的值。
Next, you implement what corresponds to the recursive subcases in the recursive algorithm, but you use values that you've already filled in. In Figure 4, I've filled in about half of the cells.
分别用循环映射法和简化递归对剖法实现了分子动力学的并行计算。
Cyclic mapping and reduction recursive bisection method were used to parallel the molecular dynamics.
讨论递归的内部实现原理。
应用推荐