开发者

Proving big O of statement [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

开发者_运维百科 Improve this question

I am having a hard time proving that n^k is O(2^n) for all k. I tried taking lg2 of both sides and have k*lgn=n, but this is wrong. I am not sure how else I can prove this.


To show that nk is O(2n), note that

nk = (2lg n)k = 2k lg n

So now you want to find an n0 and c such that for all n ≥ n0,

2k lg n ≤ c 2n

Now, let's let c = 1 and then consider what happens when n = 2m for some m. If we do this, we get

2k lg n ≤ c 2n = 2n

2k lg 2m ≤ 22m

2km ≤ 22m

And, since 2n is a monotonically-increasing function, this is equivalent to

km ≤ 2m

Now, let's finish things off. Let's suppose that we let m = max{k, 4}, so k ≤ m. Thus we have that

km ≤ m2

We also have that

m2 ≤ 2m

Since for any m ≥ 4, m2 ≤ 2m, and we've ensured by our choice of m that m = max{k, 4}. Combining this, we get that

km ≤ 2m

Which is equivalent to what we wanted to show above. Consequently, if we pick any n ≥ 2m = 2max{4, k}, it will be true that nk ≤ 2n. Thus by the formal definition of big-O notation, we get that nk = O(2n).

I think this math is right; please let me know if I'm wrong!

Hope this helps!


I can't comment yet, so I will make this an answer.

Instead of reducing the equation like you have been trying to do, you should try to find an n0 and a M that satisfy the formal definition of big O notation found here: http://en.wikipedia.org/wiki/Big_O_notation#Formal_definition

Something along the lines of n0=M=k might work (I haven't written it out so maybe that doesn't work, thats just to give you an idea)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜