prove or disprove:f(n) = O(g(n)) implies 2^f(n) = O (2^g(n))
时间: 2023-12-20 22:04:17 浏览: 72
Prove:
Assume that f(n) = O(g(n)), which means there exist constants C and n0 such that for all n≥n0, f(n) ≤ Cg(n). Then, we have:
2^f(n) = 2^(Cg(n))
= (2^C)^g(n)
Let's assume that there exist constants C' and n1 such that for all n≥n1, 2^f(n) ≤ C'2^g(n).
Then we have:
(2^C)^g(n) ≤ C'2^g(n)
Take the logarithm of both sides, we get:
g(n) * log(2^C) ≤ log(C') + g(n) * log(2)
Simplifying the above equation, we get:
g(n) ≤ (log(C') + C * log(2)) / (log(2^C))
As the right-hand side is a constant, there exists some n2 such that for all n≥n2 , g(n) ≤ (log(C') + C * log(2)) / (log(2^C)), which contradicts the initial assumption that f(n) = O(g(n)).
Therefore, 2^f(n) is not O(2^g(n)).
Hence, we have proved that f(n) = O(g(n)) does not imply 2^f(n) = O(2^g(n)).
阅读全文