Suppose we have the following recurrence relation:
then:
Each iteration, the recurrence is replaced with its value as established by the original recurrence relation. Now that we've done a few iterations, let's simplify and see if there is a recognizable pattern.
There definitely seems to be a pattern here. Each iteration we're adding a
term; where
is the number of iterations that we have made. Now the question is: When is this going to stop?
From the original problem we know that:
. We can say that:
Now we can write our simplified equation in terms of
.
Now
and we know that
. Also any constant is
. So we can re-write our equation as:
So, the time complexity of this recurrence relations is
.