This traversal is interesting because it is iterative, not recursive, which is a key difference between zipper traversal and the prior clojure.walk implementation.
这种遍历非常有趣,因为它是迭代的,而不是递归的,这是 zippers 遍历与之前的 clojure.walk 实现之间的主要差别。
Once you hear that description, it's easy to write the code, in fact. This is a place where the recursive version of it is much easier to think about than the iterative one.
实际上一旦你听到了大致描述,就能很轻松的写出代码来,在这一点上应用递归来解决问题,比用迭代要容易理解多了。
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.
第 5 章介绍了划分问题、递归函数到迭代函数的转换(我可以向您保证,这非常有趣)以及阶乘和斐波纳级数的实现。
Once you hear that description, it's easy to write the code, in fact. This is a place where the recursive version of it is much easier to think about than the iterative one.
实际上一旦你听到了大致描述,就能很轻松的写出代码来,在这一点上应用递归来解决问题,比用迭代要容易理解多了。
We saw some quadratic algorithms, typically those are things with multiple nested loops, or iterative or recursive calls, where you're doing, say, a linear amount of time but you're doing it a linear number of times and so it becomes quadratic, and you'll see other polynomial kinds of algorithms.
我们看过一些平方算法,他们一般进行了多次嵌套循环,或者递归迭代调用,对一个线性操作调用线性次,这样就变成平方次了,以后你们能看到,一些多项式算法。
Whether it was recursive or iterative.
但是在这个问题里。
应用推荐