I am given this recurrence relation:
T (n) = T (n − a) + T (a) + cn
C > 0 , a >= 1 ..
my problem is with T (a) , I don’t understand how you can “recurs” a constant??
Like, if am trying to build a recurrence tree, I would go by doing this:
T (n) => cn => cn
/ \ / \
T(a) T(n - a) ca c*(n-a)
/ \ / \
?? ?? T(n-2a) T(a)
You see what I mean? What does T(a) represent??
Any resource will be much appreciated. Thanks.
OR, think of it iteratively:
T (n) = T (n − a) + T (a) + cn
T (n) = T (n -2a) + T (a) + ????
So you have:
What is T(n-a)? Simply take n-a as your input:
Now what is T(a)? Similarly, take a as an input:
Combining them, you obtain:
Now depending on your base case, T(0) probably is some constant.
Hope that helps.