GATE CSE
First time here? Checkout the FAQ!
x
0 votes
139 views
asked in Algorithms by (391 points)   | 139 views

1 Answer

+1 vote
Best answer
This is a simple question @Himanshu :)

Given , T(n) = T(n-1) + c

      ⇒   T(n) = (T(n-2) + c) + c [We substitute for T(n-1) similarly here]

      ⇒   T(n)  = (T(n-3) + c) + c + c = T(n-3) + 3c

     .

     .

      ⇒   T(n)  = T(n-n) + nc = T(0) + nc

     Considering T(0) = some constant , we have

     T(n)  =  nc  = O(n)
answered by Veteran (66.5k points)  
selected by
Ya i know its very simple but its my first time i m doing these type of questions never did that so its not simple for me but anyway thanks a lot @habibkhan :)
Ok @Himanshu bro..Its fine..Most welcome ..:)


Top Users May 2017
  1. akash.dinkar12

    3166 Points

  2. pawan kumarln

    1648 Points

  3. sh!va

    1600 Points

  4. Arjun

    1380 Points

  5. Bikram

    1372 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1132 Points

  8. Angkit

    1044 Points

  9. LeenSharma

    900 Points

  10. srestha

    714 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    458 Points

  2. pawan kumarln

    274 Points

  3. Ahwan

    236 Points

  4. Arnab Bhadra

    234 Points

  5. bharti

    190 Points


22,778 questions
29,106 answers
65,165 comments
27,647 users