Time Complexity

Please explain this one, how is it coming to be n, and also can the time subtracted like of T(n-3).
The running time of an algorithm is given by T(n) = T(n - 1) + T(n - 2) - T(n - 3), if n > 3 n, otherwise.

n

log n

n+1

None of these

hello @Sakshi2004

running time will be exponential becuase every time we are making call to 3 new calls .

if they are asking about value of t(n) then it will be N.

none of these is correct answer

We have to tell the time complexity based on given recurrence relation. But through your point I wanted to know the difference between running time and the value of finding t(n) in the given relation. won’t they be same denoting the maximum time taken by a code following this recurrence relation? Please elaborate and explain.

see 2+4 = 6
answer is 6 ok? but time taken to get 6 is not 6 right?

same is the case with
t(n) is some function whose value is n for given input n.

but our program dont know this ,it will follow the recursive approach and becuase of that it will take exponential time

run this code and see the difference->

correction : it is a time complexity function only, i misinterpret it with general recusive function .i thought the function is given and we need to find its complexity.
the answer is O(N) only.

becuase its time complexity function, value of function is nothing but time the algorithm takes .

@Sakshi2004

is it clear now?