Hello! i'm from Italy, and i'm trying to solve this equation:
T(n) = T(n - 1) + T(n - 2) + n
my result is that the big theta notation of this equation is Θ(2^n) and the big O notation is O(2^n) * (n)
but i think that i made something wrong. Can someone explain me how to calculate the tree main landau symbols of this equation? (O, Ω and Θ)? i need some help because i have the test not too far away. Thank you!
I haven't worked much with recurrance relations and I was hoping to be able to solve this one formally but unfortunately I haven't been very successful.
Regarding your solution it looks like you've come up with a Fibonacci tree but that corresponds to only this part of the equation doesn't it?
T(n) = T(n - 1) + T(n - 2)
What I do know is that a Fibonacci tree grows almost as fast as a binary three corresponding to this equation,
T(n) = T(n - 1) + T(n - 1) = 2*T(n-1)
And both have exponential growth so it should be O(c^n) for both.
The question is what happens when you add the n term? I have been able to solve this,
T(n) = 2*T(n-1) + n
and according to my results the dominant term becomes 3*2^n when n grows big. This also means your equation has exponential growth too (because it's bound between two equations with exponential growth), like
So I'm pretty sure Big-O for your equation is O(c^n). I come back if I manage to actually solve it. The problem I'm having is that when I solve it as a second order difference equation the solution I get doesn't correspond to the values you expect when you use the formula as a recurrence relation. I'll try to figure out why this is so.
Last edited by nuzzle; March 30th, 2010 at 10:46 AM.
finally, the not difficult but very boring part: we need to calculate the Laurent expansion of the right hand side... I have no time at the moment, so I simply computed the expansion in Wolfram Mathematica; it gives me
((1/2 (1 - Sqrt))^n (-5 + 3 Sqrt + A + Sqrt A - 2 B) + (1/2 (1 + Sqrt))^n (5 + 3 Sqrt + (-1 + Sqrt) A + 2 B))/(2 Sqrt) - n - 3
which seems correct (of course A,B,n integers and n>=2 ). Indeed, as nuzzle said, it's O(c^n).
wow thank you to both of you! the only thing is that i have never made the z-transforms and they seems a little bit complicated! i would try to solve them with an easier method, but i don't understand how i can do... because the other exercises that my teacher gave us were much easier, but this one is more difficult... isn't there another way to solve them?? for example with the tree (as i did in the file i posted), or just substitution would be better! thank you!
well, the z transform is the most systematic way of solving these equations (more specifically, when you'll study a bit of complex analisys you'll immediately recognize that the "n" term in your recurrence equation add an holomorphic term to the z transform; this basically means that the result can be "somehow" computed this way ... )
but there are certainly other ways of solving it. For example, you can "linearize" your recurrence equation by representing the recurrence step as a linear operator in a suitable vector space. Then, the problem essentially reduces to a matrix diagonalization
(an hint: how does the quadruple (T[n+1],T[n],n,1) get transformed by the recurrence step ? ).