开发者

Question on big o proofs

I have the f开发者_运维技巧ollowing question:

Is the following statement true or false?

All logs to base 2

log2n is a member of O(log(n))

My attempt:

  • log2n - clogn <= 0
  • log2 + logn - clogn <= 0
  • 1 + logn(1-c) <= 0

Now correct me if I'm wrong, but I have to find values for n (variable) and c (constant) which either prove or disprove this...

Generally this seems to be true:

Choose

n0 = 2, c = 3 -> TRUE 
n1 = 3, c = 3 -> TRUE 
n2 = 4, c = 3 -> TRUE

Therefore, the statement seems true, logn increases as n does. But there are also values for which the above statement will never hold:

e.g.

Choose c = 1 evaluates to greater than zero regardless of the increasing value of n.

So I am confused as to whether this is true or false....


You could just use the fact that the logarithm of a product is the sum of the logarithms of the factors:

log(2n) = log(2)+log(n) = O(log(n))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜