Is
log(f(n)) = O(log(g(n)))
? No, it is not essential, for example:f(n)= n
andg(n) = n^2
. Heref(n) = O(g(n))
Is
N^{f(n)}=O(N^{g(n)})
? No, this is also not true as
for two algorithms , the ratio may remain constant, but the ratio of each raised to certain power will never be constant.
Take
f ( n ) = 2 n and g ( n ) = n .
It is true that 2n
is O(n)
. But consider
This limit is not bounded - it goes to infinity as n goes to infinity. So,
2^2n
is not O(2n)
i.e. 2f(n)
is not O(2g(n))
in this case.