Awesome q2a theme
0 votes
15 views
int f1(int n)

{

if(n==0||n==1)

return n;

else
return (2*f1(n-1)+3*f1(n-2));

}


Time complexity of above function
in Algorithms by (6 points) | 15 views

1 Answer

+1 vote
The complexity of the function is same as computing the complexity of Fibonacci recursive function.

$\text{F(n) = F(n-1) + F(n-2)}$

just that the original function call has a factor of constant multiplied to $\text{F(n-1)  and  F(n-2)}$

Hence the time complexity will $O(2^n)$
by (351 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Apr 2020
  1. Ram Swaroop

    38 Points

  2. Kushagra गुप्ता

    36 Points

  3. !KARAN

    36 Points

  4. sushmitagoswami

    6 Points

  5. iot_ts

    6 Points

  6. TrenaGreeves

    5 Points

  7. Theda53E2483

    5 Points

  8. FrancescoG89

    5 Points

  9. PalmaMast586

    5 Points

  10. MarciaNaranj

    5 Points

3,527 questions
1,658 answers
10,469 comments
90,059 users