Open In App

GATE | GATE 2017 MOCK II | Question 17

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads