Let $f(n)$, $g(n)$ and $h(n)$ be functions defined for positive integers such that $f(n) = O(g(n))$, $g(n) \neq O(f(n))$, $g(n) = O(h(n))$, and $h(n) = O(g(n))$.
Which one of the following statements is FALSE?
@Avir Singh Take f(n) = log n , g(n) = n , h(n) = n. And then solve the question.
In option A f(n)+g(n)=O(h(n)+h(n))
f(n)+g(n)=O(2(h(n))) f(n)+g(n)=O(h(n)) f(n)+g(n) <= h(n) Now since h(n)= Θ(g(n))
f(n)+h(n) <= h(n) It is false as LHS is greater than RHS.
How this procedure is wrong???
Answer is (D).
We can verify as : $f \leqslant g$ but $g \nleqslant f$. Therefore, $f<g$.
Also, $g=h$, as $g=O(h)$ and $h=O(g)$.
but why is option D is false
suppose f(n) = n, g(n) = n^2 , h(n) = n^2,
then f(n)h(n) = n*n^2 = n^3
O(g(n)h(n)) = O(n^2 * n^2 ) = O(n^4)
so is not n^3 = O(n^3) ?
option A:
f(n)+g(n)=O(g(n)+h(n) [ g(n) = O(h(n)), and h(n) = O(g(n)) which proves g(n)=h(n) ]
=g(n)+h(n)
=O(h(n))+h(n)
64.3k questions
77.9k answers
244k comments
80.0k users