📜  递归的时间复杂度 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:57.933000             🧑  作者: Mango

代码示例1
void recursiveFun4(int n, int m, int o)
{
    if (n <= 0)
    {
        printf("%d, %d\n",m, o);
    }
    else
    {
        recursiveFun4(n-1, m+1, o);
        recursiveFun4(n-1, m, o+1);
    }
}
Here, it's O(2^n), or exponential, since each function call calls itself twice unless it has been recursed n times.