$\sum_{i=1}^n g(i) = \mathcal{O}(\sum_{i=1}^n h(i))$ imply that $g(n) = \mathcal{O}(h(n))$

50 Views Asked by At

Does $\sum_{i=1}^n g(i) = \mathcal{O}(\sum_{i=1}^n (h(i)))$ imply that $g(n)= \mathcal{O}(h(n))$ when $g,h : \mathbb{N} \to \mathbb{R+}$?

I think this statement is wrong.

Is the following a valid counterexample ?

$g(n)=1 , \;\; h(n)=(\frac{1}{n})$

or this statment is actually true and i need to prove it ?

1

There are 1 best solutions below

0
On

In your example, the summatory function of $g$ is $\sim n$ but the summatory function of $h$ is $\sim \log n$ so the assumption is not satisfied.