Are 2^n and 4^n in the same Big-Θ complexity class?

◇◆丶佛笑我妖孽 提交于 2019-12-04 06:37:50
chiwangc

2^n is NOT big-theta (Θ) of 4^n, this is because 2^n is NOT big-omega (Ω) of 4^n.

By definition, we have f(x) = Θ(g(x)) if and only if f(x) = O(g(x)) and f(x) = Ω(g(x)).

Claim

2^n is not Ω(4^n)

Proof

Suppose 2^n = Ω(4^n), then by definition of big-omega there exists constants c > 0 and n0 such that:

2^n ≥ c * 4^n for all n ≥ n0

By rearranging the inequality, we have:

(1/2)^n ≥ c for all n ≥ n0

But notice that as n → ∞, the left hand side of the inequality tends to 0, whereas the right hand side equals c > 0. Hence this inequality cannot hold for all n ≥ n0, so we have a contradiction! Therefore our assumption at the beginning must be wrong, therefore 2^n is not Ω(4^n).


Update

As mentioned by Ordous, your tutor may refer to the complexity class EXPTIME, in that frame of reference, both 2^n and 4^n are in the same class. Also note that we have 2^n = 4^(Θ(n)), which may also be what your tutor meant.

Yes: one way to see this is to notice 4^n = 2^(2n). So 2^n is the same complexity as 4^n (exponential) because n and 2n are the same complexity (linear).

In conclusion, the bases don't affect the complexity here; it only matters that the exponents are of the same complexity.

Edit: this answer only shows that 4^n and 2^n are of the same complexity, not that 2^n is big-Theta of 4^n: you're correct that this is not the case as there is no constant k such that k*n^2 >= n^4 for all n. At some point, n^4 will overtake k*n^2. (Acknowledgements to @chiwangc / @Ordous for highlighting the distinction in their answer/comment.)

Yes. Both have exponential complexity.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!