how to solve the reccurance relation given below

T(n)=T(n+1)+1,given that T(1)=1

Recommended Answers

All 3 Replies

Well, for that, you could just plug in values of n such as -5 and -7 and notice a pattern.

but the examinar given options like below
1.O(square of n)
2.O(n)
3.O(1)
4.theata of square of n

If we use substitution method, finding T(n) for different values of n with boundary condition
T(1)=1, We obtain arelation of the form T(n)=-n+2, which can be written as O(n). Is it right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.