It started with the recurrence relation function on the Casio FX-GC100 graphing calculatorSince a recurrence relation is ...
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
所谓尾递归,就是递归调用是函数体里最后一步操作,调用结果直接返回,不再参与任何计算。 比如上面的 factorial 就不是尾递归,因为 return n * factorial (n - 1) 在递归返回之后还要做一次乘法。 改成尾递归需要把乘积累计起来传给下一层: ...