Machine-translated by Google. Questions are authored in English.
Top

Discussion

If \(f(n) = 4n^{2}\) for all n and \(g(n) = n\) if \(n \gt 100\) and \(n^{3}\) if \(n \le 100\), then :

  • A.\(g(n)\) is of \(O(f(n))\)
  • B.\(g(n)\) is of \(\Omega(f(n))\)
  • C.\(f(n)\) is of \(O(g(n))\)
  • D.\(g(n)\) is of \(\theta(f(n))\)

Answer: A

The answer is \(g(n)\) is of \(O(f(n))\).

Big-O describes behaviour for large n. For \(n \gt 100\), \(g(n) = n\) while \(f(n) = 4n^{2}\), and \(n \le 4n^{2}\) for all such n, so \(g(n) = O(f(n))\). The definition of \(n^{3}\) for small n does not matter, because only values beyond some threshold count.

For the same reason \(f(n) = 4n^{2}\) grows faster than \(g(n) = n\), so \(f(n)\) is not \(O(g(n))\), \(g(n)\) is not \(\Omega(f(n))\), and hence not \(\theta(f(n))\).

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.