441 views

1 Answer

1 votes
1 votes

Consider this function as

  • T(n) = 1 when n=1 
  • T(n) = 2T(n-1) + n when n>1  

No need to worry about small constant differences like T(n-1) + T(n-2) written as T(n-1) + T(n-1).

Here, while solving this we multiply in the middle by 2 because that was a case of AP & GP together in the series so we neglect the AP one and solve the GP easily.


Complexity Class : Exponential 

 

Related questions

3.1k
views
1 answers
3 votes
im.raj asked Jun 16, 2016
3,141 views
A. T(n) = $O( n Log n)$B. T(n) = $O({(logn)}^2)$C. T(n) = $O(n)$D. T(n) = $O(n^2)$
1.4k
views
1 answers
2 votes
Vaniyesho asked Dec 1, 2016
1,357 views
What is the time complexity of T(n)=T(n-1)+√(n-1)