What's the term for “double recursion”?

前提是你 提交于 2019-11-29 09:23:39

It's called mutual recursion.

As Jon Purdy said, the example you gave is called "mutual recursion". The term "double recursion" also exists, but with a different meaning: for when a function uses two recursive calls. The classic example is the Fibonacci function"

int Fib(int n)
{
  if (n < 2) return 1;
  return Fib(n-1) + Fib(n-2);
}

The Fib(n) function recursively calls itself twice.

One interpertaion of double recursion could be divide and conquer (e.g) quicksort

quicksort = quicksort smaller ++ pivot ++ quicksort larger
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!