Python recursive functions

Source: Internet
Author: User

1, recursive function: The simple point is that they call themselves, the recursive function must have a definite end condition, python default maximum recursion number is 999 times, the purpose is to protect the resources are not exhausted

2, each time into a deeper level of recursion, the problem specification should be reduced by the last recursion

3, recursive efficiency is not high, too many recursive hierarchy will lead to stack overflow (in the computer, the function call is implemented through the data structure of the stack, whenever a function call, will be added a stack frame, whenever the function returns, will reduce a stack frame, because the size of the stack is not infinite, so the number of recursive calls too much, will cause stack overflow)



Python recursive functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.