edited by
497 views
0 votes
0 votes
What is the time complexity of the following function ?
int foo(int num)
    {
    int result=0;
    if(num<=1) return 1;
    else
        {
        for(i=num;i>=1;i--)
            {
            result+=foo(i/3);
            }
        }
    return result;
    }

 

edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
amit166 asked Sep 9, 2018
380 views
Let G = (V, E) be any connected undirected edge-weighted graph. The weights of the edges in E are positive and distinct. Consider the following statements: (I) Minimum sp...
1 votes
1 votes
1 answer
2
aka 53 asked Nov 23, 2017
384 views
for ( i= 1; i<=n; i++) for(j=n/3: j<=2n; j=j+n/3) sum =sum+1;What will be O and θ for this
0 votes
0 votes
1 answer
3
Tankut asked Apr 4
74 views
A non empty set A is termed as an algebraic structure ________a)with respect to binary operation *b)with respect to ternary operation ?c)with respect to binary operation ...
0 votes
0 votes
1 answer
4
Biswajit Kumar asked Sep 13, 2023
203 views
Consider the following language definition:L= {(M) | M is a DFA and M accepts some string of the form ww^R for some w€ ΣL isA. RegularB. Context-free but not regularC....