3,483 views
2 votes
2 votes
Given that, f(n) = O(g(n)) then it implies that h(f(n)) = O(h(g(n)).
State TRUE/FALSE with proper Explanation/Examples.Please provide mathematical proof,don't just prove by giving a counter example

3 Answers

Best answer
3 votes
3 votes

$f(n) = O(g(n))$

means there exists an $N$ and $C$ such that

$f(n) \leq C.g(n), \forall n > N$.

Now, we apply a function $h$ on either side. Will the equation holds true?

  • Case 1: Consider $f(n) = C. g(n), \forall n > N, C > 1$. Now, it is clear that value of $f(n) > g(n)$ for all large $n$ (though their growth rates are the same). So, if we take $h$ as any exponential function $h(f(n)) > h(g(n))$ or $h(g(n)) = o(h(f(n))$ (small o). The given statement is false. 
  • Case 2: We alreayd proved that the statement is false. Now, suppose the statement given says small-o $(<)$ and not big-O $(\leq)$. In this case the statement holds true provided $h$ is a strictly (monotonically) increasing function - i.e., as the input increases value of $h$ also increases. If we consider a decreasing function like $\frac{1}{x}$, then the statement is false.
edited by
0 votes
0 votes

It is TRUE

Say,

g(n)=n2

f(n)=log n

Now put n=2x

So, g(n)=22x

f(n)=x

So, f(n)=O(g(n))

Now, h(n)=n3

g(n)=(n2)3

f(n)=(log n)3=n6

Now, putting n=2x , we get

h(g(n))=26x

h(f(n))=x3

Hence proved h(f(n)) = O(h(g(n)).

edited by

Related questions

541
views
0 answers
0 votes
kira000 asked Jan 17, 2023
541 views
Let $f(n)$ be a positive increasing function. Consider the below two statements:S1: if an algorithm is $\Theta(f(n))$ in the average case, then it is $\Omega(f(n))$ ... $g(n)$ belongs to the set $\Theta(f(n))$, right?