Skip to content
Official PYQ · 2015

GATE CS 2015 Set 3 Q42 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

Let f(n)=nf(n) = n and g(n)=n(1+sin⁡ n)g(n) = n^{(1 + \sin \: n)}, where nn is a positive integer. Which of the following statements is/are correct?

  1. f(n)=O(g(n))f(n) = O(g(n))
  2. f(n)=Ω(g(n))f(n) = \Omega(g(n))
Choose one option
View worked solution

Answer: D

To determine the relationship between f(n)=nf(n) = n and g(n)=n1+sin⁡ng(n) = n^{1 + \sin n}, we analyze the ratio f(n)g(n)\frac{f(n)}{g(n)} as n→∞n \to \infty.

The term sin⁡n\sin n oscillates densely in the interval [−1,1][-1, 1] as nn ranges over the positive integers. Let us compute the ratio:

f(n)g(n)=nn1+sin⁡n=n−sin⁡n\frac{f(n)}{g(n)} = \frac{n}{n^{1 + \sin n}} = n^{-\sin n}

Now, let's evaluate both statements:

  1. Statement I: f(n)=O(g(n))f(n) = O(g(n))

    For f(n)=O(g(n))f(n) = O(g(n)) to hold, there must exist a positive constant cc such that f(n)g(n)≤c\frac{f(n)}{g(n)} \le c for all sufficiently large nn.

    However, we can choose a sequence of integers nn where sin⁡n≈−1\sin n \approx -1. For these values:

    f(n)g(n)=n−sin⁡n≈n1=n\frac{f(n)}{g(n)} = n^{-\sin n} \approx n^1 = n

    As n→∞n \to \infty, this ratio grows without bound. Thus, no such constant cc exists, and f(n)≠O(g(n))f(n) \neq O(g(n)). Statement I is incorrect.

  2. Statement II: f(n)=Ω(g(n))f(n) = \Omega(g(n))

    For f(n)=Ω(g(n))f(n) = \Omega(g(n)) to hold, there must exist a positive constant c>0c > 0 such that f(n)g(n)≥c\frac{f(n)}{g(n)} \ge c for all sufficiently large nn.

    However, we can choose a sequence of integers nn where sin⁡n≈1\sin n \approx 1. For these values:

    f(n)g(n)=n−sin⁡n≈n−1=1n\frac{f(n)}{g(n)} = n^{-\sin n} \approx n^{-1} = \frac{1}{n}

    As n→∞n \to \infty, this ratio approaches 00. Thus, the ratio cannot be bounded below by any positive constant c>0c > 0. Therefore, f(n)≠Ω(g(n))f(n) \neq \Omega(g(n)). Statement II is incorrect.

Since both statements are incorrect, the correct option is D.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Asymptotic Worst Case Time and Space Complexity questions