更改

跳到导航 跳到搜索
删除708字节 、 2020年12月27日 (日) 23:29
第1,042行: 第1,042行:  
===栈空间===
 
===栈空间===
   −
In some programming languages, the maximum size of the [[call stack]] is much less than the space available in the [[Heap (programming)|heap]], and recursive algorithms tend to require more stack space than iterative algorithms. Consequently, these languages sometimes place a limit on the depth of recursion to avoid [[stack buffer overflow|stack overflow]]s; [[python (programming language)|Python]] is one such language.<ref>{{cite web|url=https://docs.python.org/library/sys.html |title=27.1. sys — System-specific parameters and functions — Python v2.7.3 documentation |publisher=Docs.python.org |accessdate=2012-09-03}}</ref> Note the caveat below regarding the special case of [[tail recursion]].
      
在一些编程语言中,调用栈的最大规模远小于堆中的可用空间,而递归算法往往比迭代算法需要更多的栈空间。因此,这些语言有时会对递归的深度进行限制,以避免栈溢出;Python就是这样一种语言<ref>{{cite web|url=https://docs.python.org/library/sys.html |title=27.1. sys — System-specific parameters and functions — Python v2.7.3 documentation |publisher=Docs.python.org |accessdate=2012-09-03}}</ref>。注意下面关于尾部递归的特殊情况的注意事项。
 
在一些编程语言中,调用栈的最大规模远小于堆中的可用空间,而递归算法往往比迭代算法需要更多的栈空间。因此,这些语言有时会对递归的深度进行限制,以避免栈溢出;Python就是这样一种语言<ref>{{cite web|url=https://docs.python.org/library/sys.html |title=27.1. sys — System-specific parameters and functions — Python v2.7.3 documentation |publisher=Docs.python.org |accessdate=2012-09-03}}</ref>。注意下面关于尾部递归的特殊情况的注意事项。

导航菜单