码迷,mamicode.com
首页 > 其他好文 > 详细

Advantages & Disadvantages of Recursion

时间:2019-08-18 09:30:00      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:mic   sel   dynamic   ble   overflow   stack   ges   step   enc   

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

标签:mic   sel   dynamic   ble   overflow   stack   ges   step   enc   

原文地址:https://www.cnblogs.com/ireneyanglan/p/11371286.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!