online advertising
Loading [MathJax]/jax/output/HTML-CSS/jax.js

Thursday, October 8, 2015

Algorithms: Design and Analysis, Part 1 - Problem Set 1 - Question 2

Problem:

You are given functions f and g such that f(n)=O(g(n)). Is f(n)log2(f(n)c)=O(g(n)log2(g(n))) ? (Here c is some positive constant.) You should assume that f and g are nondecreasing and always bigger than 1.

Solution:

Using the definition of the Big-Oh notation, we are given:

f(n)<c1g(n) for n>n0.

Let's try to derive a bound for the left hand side, we have

f(n)<c1g(n)f(n)c<(c1g(n))clog2(f(n)c)<log2((c1g(n))c)log2(f(n)c)<clog2(c1)+clog2(g(n))f(n)log2(f(n)c)<cc1g(n)log2(c1)+cc1g(n)log2(g(n))

So far, the proof is obvious:
The second line comes from the assumption that the values are bigger than 1
The third line comes from logarithm is monotonic.
The rest is just simplification of properties of log.

To simplify things further, we get d=cc1log2(c1) and e=cc1, so we have

f(n)log2(f(n)c)<dg(n)+eg(n)log2(g(n))=g(n)(d+elog2(g(n))=g(n)(dlog2(g(0))log2(g(0))+elog2(g(n))g(n)(dlog2(g(0))log2(g(n))+elog2(g(n))=(dlog2(g(0))+e)g(n)log2(g(n)

The critical line above is line 4, where we use the fact that g(n) is non-decreasing. Together we proved f(n)log2(f(n)c)=O(g(n)log2(g(n)))

No comments:

Post a Comment