The running time of an algorithm T(n),where 'n' is the input size, of a recursive algorithm is given as follows.is given by
T(n) =c + T(n - 1), if n > 1
d, if n ≤ 1
A. | n2 |
B. | n |
C. | n3 |
D. | nn |
Answer : B Explanation :
By recursively applying the relation we finally arrive at
T(n-I) = c(n-I) + T (1) = c(n-I)+d
So, order is n
bhawna said: (5:47pm on Monday 30th September 2013)
don't understand hat the exact solution what is c and d here
sakshi said: (8:34pm on Tuesday 8th August 2017)
don't understand pls explain in details
|
|
Option: A Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. |