• edited by
4,423 views
3 3 votes

recurrence relation for the functional value of F(n) is given below :

$F(n) = a_{1}F(n-1) + a_{2}F(n-2) + a_{3}F(n-3) + \ldots + a_{k}F(n-k)$  

where $a_{i} =$ non zero constant.

Best time complexity to compute F(n) ?

assume k base values starting from F(0), F(1), to F(k-1) as $b_{0} , \ b_{1} \ , b_{2} \ .... \ b_{k-1}$ ; $b_{i} \neq 0$

A. Exponential ( $O(k_{2}r^{k_{1}n})$) 

B. Linear ( $O(n)$ )

C. Logarithmic ( $O(\log n)$ )

D. $O(n \log n)$

1 Answer

1 1 vote
Removing constant terms $a_{1},a_{2}...................$

$F(n)=F(n-1)+F(n-2)+.................F(1)$

       =$F(n-1)=cr^{n-1}$

       =$F(n-2)=cr^{n-2}$

        $--------------------------$

 

So, $cr^{n-1}+cr^{n-2}+.................+cr^0=0$

$F(n)=\frac{r^{n-1}-1}{r-1}$

Complexity will be $O(r^{n-1})$ where r is a constant
Position:
Show:

Related questions

1 1 vote
1 1 answer
1.7k
1.7k views
VikramRB asked Jan 20, 2019
1,688 views
What is the time complexity of the following recurrence relation and step to derive the same$T(n) = T(\sqrt{n}) + log(logn)$
1 1 vote
1 1 answer
2.4k
2.4k views
Akriti sood asked Dec 22, 2016
2,436 views
What is the worst case time complexity of the following recurrence relation?T(n)=T(n/2)+T(n/4)+T(n/8)+n Θ(nlogn) Θ(n2) Θ(n) -i am solving like thisT(n) <...
0 0 votes
1 1 answer
1.5k
1.5k views
Siramdas Vamshidhar asked Dec 5, 2014
1,489 views
5. Determine the average processing time T(n) of the recursive algorithm:1 int myTest( int n ) {2 if ( n <= 0 ) return 0;3 else {4 int i = random( n - 1 );5 return myTest...
3 3 votes
1 1 answer
2.7k
2.7k views
Ashish Sharma 3 asked Jun 16, 2017
2,685 views
What will be the time complexity for the following recurrence relation?$T(n) = 8\sqrt{n} T(\sqrt{n})+(log n)^{2}$According to me it is $\Theta (n(logn)^{3})$ . Please con...