这个简单算法的时间复杂度是多少(for循环递归)

问题描述 投票:0回答:0
void function (int n){
    int count=0;
    int m= 10000 //(Parameter)
    for (int i=0; i<m; i++)
    {
        count++;
    }
    if (n==0)
    {
        return;
    }
    function(n/2);

}

会不会是: T(n)=T(n/2)+M 或者 T(n)=M*T(n/2)

我搞不懂有没有带for循环的递归算法,我们是加for循环还是乘以它

c recursion time-complexity
© www.soinside.com 2019 - 2024. All rights reserved.