Theory Of Computation MCQ

1:

The running time T (n), where 'n' is input size of a recursive algorithm, is given as
                                                      T (n) = c + T (n - 1), if n > 1
                                                   = d, if n ≤ 1
The order of the algorithm is

 

A.

n2

B.

n

C.

n3

D.

nn

 

Answer : B

Explanation :

Recuesivelt applying the relation, we get
T( n + 1 ) = C ( n - 1 ) + T (1)
                 = C ( n - 1 ) + d
Hence order is n.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.