I was told that “any exponential trumps any logarithm”.
But when the exponential is between zero and one, doesn’t the execution time of the logarithm grow much faster? So by that logic it would be f = O(g)
I’m having trouble choosing whether to follow my intuition or what I’ve been told, but what I’ve been told may have been not totally accurate.
Let’s try out some math here. One important fact is that the logarithm function is monotonically increasing, which means that if
then
Now, let’s see what that does here. We have two functions, x0.1 and log10 x. If we take their logs, we get
and
Since log log x grows much more slowly than log x, intuitively we can see that the function x0.1 is going to eventually overtake log10 x.
Now, let’s formalize this. We want to find some value of x such that
Let’s suppose that these are base-10 logarithms just to make the math easier. If we assume that x = 10k for some k, we get that
Now, take k = 100. Now we have that
which is clearly true. Since both functions are monotonically increasing, this means that for x ≥ 10100, it is true that
Which means that it is not true that x0.1 = O(log10 k).
Hope this helps!