GATE CSE
First time here? Checkout the FAQ!
x
0 votes
134 views
asked in Algorithms by (375 points)   | 134 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 (65.1k 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 Mar 2017
  1. rude

    4018 Points

  2. sh!va

    2994 Points

  3. Rahul Jain25

    2804 Points

  4. Kapil

    2606 Points

  5. Debashish Deka

    2092 Points

  6. 2018

    1414 Points

  7. Vignesh Sekar

    1318 Points

  8. Bikram

    1218 Points

  9. Akriti sood

    1166 Points

  10. Sanjay Sharma

    1004 Points

Monthly Topper: Rs. 500 gift card

21,439 questions
26,753 answers
60,919 comments
22,930 users