For cross verification of your answer follow whatever Arun ji has mentioned in his answer.

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+26 votes

Let $f(n) = n^2 \log n$ and $g(n) = n(\log n)^{10}$ be two positive functions of $n$. Which of the following statements is correct?

- $f(n) = O(g(n)) \text{ and } g(n) \neq O(f(n))$
- $g(n) = O(f(n)) \text{ and } f(n) \neq O(g(n))$
- $f(n) \neq O(g(n)) \text{ and } g(n) \neq O(f(n))$
- $f(n) =O(g(n)) \text{ and } g(n) = O(f(n))$

0

Here for getting quick answer first do minimization on both the sides then apply log on both the sides.

For cross verification of your answer follow whatever Arun ji has mentioned in his answer.

For cross verification of your answer follow whatever Arun ji has mentioned in his answer.

+14 votes

Best answer

A more formal approach:

$f(n) = n^2 \log n$

$g(n) = n (\log n)^{10}$

We can use the limit definition of O-notation

http://cse.unl.edu/~choueiry/S06-235/files/Asymptotics-HandoutNoNotes.pdf

$\lim_{n \to \infty } \frac{f(n)}{g(n)} = 0, \implies f(n) = o(g(n))$

small $o$ implying $f$ is strictly asymptotically lower than $g$. Also by definition, $o \implies O \text{ but } O \not \implies o$.

$\lim_{n\to \infty} \frac{f(n)}{g(n)} = c, c > 0 \implies f(n) = \Theta(g(n))$

$\lim_{n \to \infty} \frac{f(n)}{g(n)} = \infty, \implies f(n) = \omega(g(n))$

small $\omega$ implying $f$ is strictly asymptotically higher than $g$. Also by definition, $\omega \implies \Omega, \text{ but } \Omega \not \implies \omega.$

We can use this to prove the above question

For any $k > 0$

$\lim_{n \to \infty} \frac{(\log n)^{k}}{ n}$

Applying L'Hopital rule

$= \lim_{n \to \infty} \frac{ k*(\log n)^{k-1}}{ n}$

$= \lim_{n \to \infty} \frac{ k!}{n} = 0$

So $(\log n)^k = o(n)$

Now for large $n$, $n > (\log n)^9$

i.e $n^{2}\log n > n(\log n)^{10}$

So $n(\log n )^{10} = o(n^{2}\log n)$

Or

$n(\log n )^{10} = O(n^{2}\log n)$

and

$O(n^{2}\log n) \neq n(\log n )^{10}$

Option B.

+39 votes

$f(n)$ | $g(n)$ | |
---|---|---|

$n = 2^{10}$ | $10 \ast 2^{10} \ast 2^{10}$ | $2^{10} \ast 10^{10}$ |

$n = 2^{256}$ | $256 \ast 2^{256} \ast 2^{256}$ | $2^{256} \ast 256^{10}$ |

So, as $n$ is going larger, $f(n)$ is overtaking $g(n)$ and the growth rate of $f$ is faster than that of $g$. So, $g(n) = O(f(n))$ and $f(n) \neq O(g(n))$.

**B** choice.

0

If we calculate log(f(n)) and log(g(n)) then we get

log(f(n))= 2*log(n)+log(log(n))= O(log(n));

log(g(n))= log(n)+10*log(log(n))=O(log(n));

Can we say that f(n)=O(g(n)) and g(n)=O(f(n)) ?

log(f(n))= 2*log(n)+log(log(n))= O(log(n));

log(g(n))= log(n)+10*log(log(n))=O(log(n));

Can we say that f(n)=O(g(n)) and g(n)=O(f(n)) ?

0

ok sir thank you, and can u please reply to my question in TOC , i really have doubt in understanding the way to approach it thank you!https://gateoverflow.in/1994/gate2014-2-35

0

@Arjun Sir .Great , taking large values of n is probably the best way to solve such questions in gate , isnt it ?

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.2k
- Digital Logic 2k
- Programming & DS 3.7k
- Algorithms 3.2k
- Theory of Computation 4k
- Compiler Design 1.6k
- Databases 3k
- CO & Architecture 2.6k
- Computer Networks 3k
- Non GATE 1k
- Others 1.3k
- Admissions 486
- Exam Queries 435
- Tier 1 Placement Questions 18
- Job Queries 56
- Projects 9

36,171 questions

43,624 answers

124,024 comments

42,893 users