Advantages & Disadvantages of Recursion

Posted ireneyanglan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Advantages & Disadvantages of Recursion相关的知识,希望对你有一定的参考价值。

Recursion is a technique in which a problem is solved by itself; it‘s a technique to solve most Divide & Conquer problems.

Differences between Divide & Conquer problem and Dynamic Programming problem:

Sub-problems of DP usually have some relations, while Divide & Conquer is not.

Advantages

  • Easy to understand.

Disadvantages

  • Usually slower than iteration
  • Stack overflow risk: Each step will recursively call a function, which will significantly occupy a lot stack memory.
  • Difficult to debug and trace value.

 

以上是关于Advantages & Disadvantages of Recursion的主要内容,如果未能解决你的问题,请参考以下文章

Advantages and disadvantages of python language

Why Go? – Key advantages you may have overlooked

why do we need, what advantages to use mongoose

[JWT] JWT Signature With RS256 - Learn The Advantages Compared to HS256

代理与非代理消息系统的优缺点

List<T> vs BindingList<T> 优点/缺点