But representing iteration this way in java programming can be inefficient because numerous recursive calls risk overflowing the stack 但在java编程中,用这种方式表示迭代将导致效率低下,因为大量的递归调用有导致堆栈溢出的危险。
It is caused by recursively descending a composite data structure in such a way that , sometimes , more than one step in the descent is taken in a single recursive call 它是由递归下行复合数据结构引起的,这种下行方式有时在一次递归调用中要下行多级。
But because the variable parameter values are sent to the recursive call all at once , it is much easier to get the updated values right than it is in a loop 但因为所有可变的参数值都一次传给了递归调用,所以比起循环来,在尾递归中可以更容易地得到更新值。
A loop does not have the overhead of passing arguments , initializing additional storage , and returning values . your performance can be much better without recursive calls 循环不会产生传递变量、初始化附加存储空间和返回值所需的开销,因此使用循环相对于使用递归调用可以大幅提高性能。
Because of this attribute , there is a nice correspondence between tail - recursive functions and loops : each recursive call can be thought of simply as one more iteration through a loop 由于这一特点,在尾递归函数和循环之间有一个很好的对应关系:可以简单地把每个递归调用看作是一个循环的多次迭代。
You must design a recursive procedure to test for at least one condition that can terminate the recursion , and you must also handle the case where no such condition is satisfied within a reasonable number of recursive calls 您在设计一个递归过程时,必须至少测试一个可以终止此递归的条件,并且还必须对在合理的递归调用次数内未满足此类条件的情况进行处理。
In practice , the file system calls the kernel cache manager , which fulfills requests from an in - memory cache if possible and makes recursive calls to the file system driver to fill cache buffers 实际上,文件系统调用内核高速缓冲存储器管理器,这个管理器执行来自于一个内存中的高速缓冲存储器的请求,如果可能的话,并且递归调用文件系统驱动来填充高速缓冲存储器。
Less than 30 percent of that time was spent in a call to another method with the same name or in a recursive call to the same method - i can t really tell from the trace , while essentially all the remaining time was spent in a call to the 方法上。这个时间的不到30 %花在用同一个名字调用另一个方法上(或者对同一方法的递归调用我从跟踪中无法区别) ,而所有剩下的时间实质上都花在了对