0

Suppose that $n=O(\log_2 m)$. Let $f=O(m)$.

How can we prove that $f=O(2^n)$ as well?

I know that $m=2^{\log_2 m}$, but I can't simply plug $n$ there, because $n$ isn't equal to $\log_2 m$, but $O(\log_2 m)$. Can it be proven without refering to the definition of big $O$ directly? But of course I'll be fine with a proof that uses the definition as well.

What motivated me to ask this was the answer to this question.

It may of course be false as well.

1 Answers1

1

As asked here, this is false.

Note $n=0.5 \log_2 m$ is $O(\log_2 m)$ and $f=m$ is $O(m)$. But $2^n = 2^{0.5\log_2 m} = \sqrt{m}$ and $m$ is not $O(\sqrt{m})$.

Indeed, using the actual meaning of $O$ as commonly used in mathematics there would even be more extreme examples. For instance, $n=\log_2 \log_2 m$ is $O(\log_2 m)$ too or even $n=7$ or any constant is $O(\log_2 m)$, while the conclusion clearly does not hold for those $n$.

However, the intended meaning in the linked post seems different. The $O$, at least for the $n$, is rather meant to signify the actual order (of magnitude), what can be denoted as $\Theta$. Now if $c_1 \log_2 m \le n \le c_2 \log_2 m $ and $f = O(m)$ then one has $ f = O(C^n)$ for some constant $C$.

To see this just note that as $\log_2 m \le c_1^{-1}n$ we have $m \le 2^{c_1^{-1}n} = (2^{c_1^{-1}})^n$.

quid
  • 42,135
  • See the second to last paragraph of the accepted answer. I think I didn't mix anything up when rewriting it, the same thing was stated there. Then it must be wrong there as well. – user216094 Dec 14 '15 at 17:38
  • Taken strictly, yes, I think it is not correct what is written there. However, the point there is not to be very precise but rather to convey a general idea. Namely that it will be exponential. (Indeed the usage of $O$ there might not completely captured what is intended to be conveyed there.) – quid Dec 14 '15 at 18:25
  • Then the question is how to prove that $f$ will be exponential with respect to $n$? – user216094 Dec 14 '15 at 18:51
  • I expanded it a bit. – quid Dec 14 '15 at 19:05
  • I added a bit more explanation. – quid Dec 14 '15 at 20:29