Let f(n) = n2Logn and g(n) = n (logn)10 be two positive functions of n. Which of the following statements is correct?
(A) f(n) = O(g(n)) and g(n) != O(f(n))
(B) f(n) != O(g(n)) and g(n) = O(f(n))
(C) f(n) = O(g(n)) but g(n) = O(f(n))
(D) f(n) != O(g(n)) but g(n) != O(f(n))
Answer: (B)
Explanation:
Any constant power of Logn is asymptotically smaller than n.
Proof:
Given f(n) =n2Logn and g(n) = n (logn)10
In these type of questions, we suggest you to first cancel out the common factor in both the function. After removing these, we are left with f(n) = n and g(n) = (logn)9. Removing a factor of nlogn from both functions.
Now n is very very large asymptotically as compared to any constant integral power of (logn) which we can verify by substituting very large value say 2100.
f(2100) = 2100 = 1030 and g(2100) = 1009 = 1018.
Always remember to substitute very large values of n in order to compare both these functions. Otherwise you will arrive at wrong conclusions because if f(n) is asymptotically larger than g(n) that means after a particular value of n, f(n) will always be greater that g(n).
This solution is contributed by Pranjul Ahuja.
Quiz of this Question
Recommended Posts:
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 42
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 61
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 62
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 63
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 64
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 65
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 60
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 59
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 43
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 44
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 45
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 46
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 50
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 51
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 52
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 53
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 54
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 55
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 56
- GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 57

