Solving recurrences and proving bounds

Exercise 7.4-1

Show that the recurrence

T(n)=max{T(q)+T(nq1):0qn1}+Θ(n)

has a lower bound of T(n)=Ω(n2). [1]


Inductive hypothesis: T(n)n2

T(n)=max{q2+(nq1)2:0qn1}+Θ(n)

f(q)=q2+(nq1)2:0qn1


By expanding the expression we obtain

f(q)=q2+(nq)22(nq)+1

f(q)=2q2+n22nq2n+2q+1


Now let’s find the local maxima of the function using its first derivative. Taking the first derivative with respect to q we obtain:

f(q)=ddq2q2+ddqn2+ddq2nq+ddq2n+ddq2q+ddq1

Since we are looking for a critical point in the graph,

f(q)=4q2n+2=0

q=n12

This can be either a local minima or a maxima of our function. Let’s determine it next.

Let q=1 for sufficiently large n, plugging in the values in the above equation we get:

412n+2=62n<0 for sufficiently large value of n.

Now let’s plug in q=n2 in our equation:

2n2n+2=2>0

Thus, we have a local minimum of our function at q=n12

Given that this is a  continuous function, our local maxima should lie at the boundary points of the function where q=0 and q=n1

Both of these q values lead to the following recurrence.

T(n)=T(0)+T(n1)+Θ(n)

Now let’s solve this recurrence using the substitution method.

Let T(n)cn2 for some constant c>0.

Plugging into our equation we then obtain

T(n)c(n1)2+Θ(n)

By expanding brackets, we then obtain

T(n)cn2+c+n(12c)

T(n)cn2

And this holds for 0<c12 for some constant c.

Thus, T(n)=Ω(n2)

And that concludes our proof.


References

[1] https://www.amazon.com/Introduction-Algorithms-fourth-Thomas-Cormen/dp/026204630X


Comments

Popular posts from this blog

Introducing Java Reactive Extentions in to a SpringBoot Micro Service

Combining the emissions of multiple Observables together using RxJava Zip operator in a Spring Boot Micro service

RabbitMQ Transport in WSO2 ESB