GATE | GATE 2017 MOCK II | Question 17

Consider the case: f(n) = O(g(n)).

Then, following two statements are claimed to be inferred from the above case.

Statement I: 2f(n) = O(2g(n))
Statement II: 2g(n) = O(2f(n))

Choose the correct option from the given.



(A) Both statements are true
(B) Both statements are false
(C) Statement I is true and Statement II is false
(D) Statement I is false and Statement II is true


Answer: (B)

Explanation: if f(n) = n and g(n) = 2n.
then f(n) = O(g(n))
here, 2^n = O(2^(2n)) = O(4^n), but not vice versa. Hence, I is true. II is false.
————–
Now, if f(n) = 2n and g(n) = n
then also f(n) = O(g(n)) because we can ignore constant
but, 2^(2n) != O(2^n), hence I is false, but II is true.

In both of the above cases, f(n) = O(g(n)). But both the cases are counter of each other. Hence both I and II are wrong.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.