In a previous problem, I showed (hopefully correctly) that f(n) = O(g(n))
implies lg(f(n)) = O(lg(g(n)))
with sufficient conditions (e.g., lg
For any f,g: N->R*, if f(n) = O(g(n)) then 2^(f(n) = O(2^g(n)) (1)
We can disprove (1) by finding a counter-example.
Suppose (1) is true -> by Big-O definition, there exists c>0 and integer m >= 0 such that:
2^f(n) <= c2^g(n) , for all n >= m (2)
Select f(n) = 2n, g(n) = n, we also have f(n) = O(g(n)), apply them to (2).
-> 2^(2n) <= c2^n -> 2^n <= c (3)
This means: there exists c>0 and integer m >= 0 such that: 2^n <= c , for all n >= m.
There is no such c, because if there is, we always find n > lg(c) that makes (3) not true: 2^n >= c, for all n >= lg(c).
Therefore, (1) cannot be true.
Well, it's not even true to begin with.
Let's say algorithm A takes 2n steps, and algorithm B takes n steps. Then their ratio is a constant.
But the ratio of 22n and 2n is not a constant, so what you said doesn't hold.
Let, f(n) = 2log n and
g(n) = log n
(Assume log is to the base 2)
We know, 2log n <= c(log n) therefore f(n) = O(g(n))
2^(f(n)) = 2^log n^2 = n^2
2^(g(n)) = 2^log n = n
We know that
n^2 is not O(n)
Therefore, 2^(f(n)) not equal to O(2^g(n)))