PA of Algorithms Q3

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

  • Option : B
  • Explanation :
    Recursively applying the relation, we finally get
        T(n + 1) = c(n - 1) + T(1)
            = c(n - 1) + d
    hence order is n.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *