Big O /Right or wrong?

1.2k Views Asked by At

I have to decide, wether the following theorem is right or wrong. There are functions, that satisfy the following conditions:

$ f(n) \in \mathcal{O}(h(n)) $ and $ g(n) \in \mathcal{O}(h(n))$

Now it should hold: $$ \frac{f(n)}{g(n)} =\mathcal{O}(1) $$

By definition I get: $f(n) \leq c_1 \cdot h(n) \ \forall n\geq N$ and $g(n) \leq c_2 \cdot h(n) \ \forall n\geq N'$

So, $$ \frac{f(n)}{g(n)} = \frac{c_1}{c_2} \cdot 1 \ \forall n\geq max\{N,N'\}$$

I'm not sure. g(n) could be 0. What do you think?

2

There are 2 best solutions below

3
On BEST ANSWER

You can't go from $f \leqslant c_1 h$ and $g \leqslant c_2 h$ to $\frac{f}{g} = \frac{c_1}{c_2}$.

And the initial claim is false. Take, for example, $f(n) = h(n) = n^2$, $g(n) = n$.

0
On

Consider $f(n)=h(n)=1$ and $g(n)=1/n$.