Recursion !!! Recursive calls should not address subproblems that overlap !!!

来源:互联网 发布:centos7 更新 PHP 编辑:程序博客网 时间:2024/06/05 17:08

Recursion. A recursive method is a method that calls itself either directly or indirectly. There are three important rules of thumb in developing recursive programs:

  • The recursion has a base case.
  • Recursive calls must address subproblems that are smaller in some sense, so that recursive calls converge to the base case.
  • Recursive calls should not address subproblems that overlap.