Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尾递归 #71

Open
nmsn opened this issue Dec 7, 2022 · 1 comment
Open

尾递归 #71

nmsn opened this issue Dec 7, 2022 · 1 comment

Comments

@nmsn
Copy link
Owner

nmsn commented Dec 7, 2022

如题

@nmsn nmsn added ES6 JavaScript and removed ES6 labels Dec 7, 2022
@nmsn
Copy link
Owner Author

nmsn commented Dec 7, 2022

尾递归,比线性递归多一个参数,这个参数是上一次调用函数得到的结果;

所以,关键点在于,尾递归每次调用都在收集结果,避免了线性递归不收集结果只能依次展开消耗内存的坏处。

https://www.zhihu.com/question/20761771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant