Não foi possível encontrar esta entrada. Mostrando resultados aproximados. Verifique a ortografia ou proponha a adição deste termo ao dicionário.
尾部递归
尾递归
Note that inserting is actually in-place, since all the calls above use tail recursion.
注意插入实际上是原地算法 ,因为上述所有调用都使用了尾部递归 。
Again, the function calls all use tail recursion, so the algorithm is in-place.
同样的,函数调用都使用了尾部递归 ,所以算法是原地算法 。
Tail-recursion is an important concept to understand before we can analyse the behavior of a functional program. I will try to illustrate what tail recursion is with an Elm-like pseudocode. Though you don't need to know any Elm to understand this post.
Tail Recursion is one type of Recursion, in which a function calls itself as its last expression. Tail Recursion is very popular in functional programming.
尾递归是递归的一种,特点在于会在函数的最末调用自身。尾递归是函数式编程的常见写法。
Since many Scheme compilers use C as an intermediate target code, the tail recursion must be encoded in C without growing the stack, even if the C compiler does not optimize tail calls.
由于很多 Scheme 的编译器使用 C 作为中间目标语言,问题可转化为如何在 C 里在不让栈向上增长的前提下实现尾部递归(假设 C 的编译器不优化尾部调用)。
PS: Tail Recursion can be optimized at compile time. So there's no need to worry about stack overflow.
注:尾递归会在编译期优化,因此不用担心递归造成的栈溢出问题。
Tail recursion (or tail-end recursion) is particularly useful, and often easy to handle in implementations.
尾调用不一定是递归调用,但是尾递归特别有用,也比较容易实现。
However, in functional programming languages, tail call elimination is often guaranteed by the language standard, allowing tail recursion to use a similar amount of memory as an equivalent loop.
Os exemplos servem apenas como ajuda na tradução da palavra ou da expressão procurada. Eles não são selecionados ou validados por nós e podem conter linguagem inapropriada. Pedimos que reporte exemplos que devem ser modificados ou que não devem ser exibidos. As traduções potencialmente sensivéis, impróprias ou coloquiais geralmente são marcadas em vermelho ou em laranja.