edited by
18,792 views
63 votes
63 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?

  1. $f(n) = O(g(n)) \text{ and } g(n) \neq O(f(n))$
  2. $g(n) = O(f(n)) \text{ and } f(n) \neq O(g(n))$
  3. $f(n) \neq O(g(n)) \text{ and } g(n) \neq O(f(n))$
  4. $f(n) =O(g(n)) \text{ and } g(n) = O(f(n))$
edited by

7 Answers

0 votes
0 votes

Reference:Solution of Arjun Sir

Case-I

$f(n)=n^{2} logn$ 

take $n=2^{10}$  So, $f(n)=2^{20} log2^{10}$  

$f(n)=2^{20} $ *10 $

and $g(n)= n (logn)^{10}$ 

take $n=2^{10}$  So, $g(n)= 2^{10}(log2^{10})^{10}$

$g(n)= 2^{10}* 10^{10}$

Case-II

And now take one more value 

take $n=2^{256}$ 

o, $f(n)=2^{512} log2^{256}$  

$f(n)=2^{512} $ *256 $

and $g(n)= n (logn)^{10}$ 

take $n=2^{256}$  So, $g(n)= 2^{256}(log2^{256})^{10}$

$g(n)= 2^{256}* 256^{10}$

Now, main problem is how to check which one is bigger than other.

Just do one simple thing divide each other 

like in case-I , if you'll divide f(n)/g(n) 

f(n)/g(n) = $2^{20} $ *10  / $2^{10}$ * $10^{10}$

f(n)/g(n) = $2^{10} $ *10  / $10^{10}$

f(n)/g(n) = 10240 / $10^{10}$

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

 

Now Case-II,

f(n)/g(n) = $2^{512} $ *256  / $2^{256}$ * $256^{10}$

f(n)/g(n) = $2^{256} $ *256  / $256^{10}$

Here, you can simply use Scientific calculator during GATE exam, and you will see quotient is >0.

So, here f(n)> g(n)  , g(n) = O(f(n)) and you can find n where f(n) always greater than g(n)

So, Option B

0 votes
0 votes

f(n) = n2logn; g(n) = n(logn)10
Cancel nlogn from f(n), g(n)
f(n) = n; g(n) = (logn)9
n is too large than (logn)9
So f(n)! = O(g(n)) and g(n) = O(f(n))

So option B

–4 votes
–4 votes
ans is A.

for n=2 : f(n)=4, g(n)=2

for n=3 : f(n)=14, g(n)=300
Answer:

Related questions

43 votes
43 votes
4 answers
1
Kathleen asked Sep 14, 2014
13,693 views
Randomized quicksort is an extension of quicksort where the pivot is chosen randomly. What is the worst case complexity of sorting n numbers using Randomized quicksort?$O...
29 votes
29 votes
3 answers
3