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

Algorithm Analysis and Complexity Questions and Answers

Answer: A

The true statement is \(f(n^{2}) = \theta(f(n)^{2})\) when \(f(n)\) is a polynomial.

If \(f(n)\) is a polynomial of degree \(d\) with leading coefficient \(c \gt 0\), then \(f(n^{2})\) grows like \(c\,n^{2d}\) and \(f(n)^{2}\) grows like \(c^{2} n^{2d}\). They differ only by a constant factor, so each is \(\theta\) of the other.

The others fail for some positive function. For \(f(n) = n\), \(f(n^{2}) = n^{2} = f(n)^{2}\), which is not \(o(f(n)^{2})\). For \(f(n) = 2^{n}\), \(f(n^{2}) = 2^{n^{2}}\) outgrows \(f(n)^{2} = 2^{2n}\), so it is not \(O(f(n)^{2})\). For \(f(n) = \log n\), \(f(n^{2}) = 2\log n\) grows slower than \((\log n)^{2}\), so it is not \(\Omega(f(n)^{2})\).

Please log in or register to report this question.

12.

The correct ordering of the growth rates \(3^{n}\), \(n^{3}\), \(3^{3}\), \(\log_{3} n\) is :

Exam Year(s)

MH SET - 2019, SET Exam - 2019,

Answer: D

The correct order is \(3^{3},\ \log_{3} n,\ n^{3},\ 3^{n}\).

\(3^{3} = 27\) is a constant, which does not grow at all. A logarithm grows, but more slowly than any power of n. A polynomial \(n^{3}\) grows more slowly than any exponential function, so \(3^{n}\) is the fastest:

\[ O(1) \lt O(\log n) \lt O(n^{3}) \lt O(3^{n}) \]

Options (A) and (B) put \(\log_{3} n\) below a constant, which is wrong for large n, and (A) also puts the constant after \(n^{3}\). Option (C) puts \(3^{n}\) before \(n^{3}\), but the exponential eventually outgrows any polynomial.

Please log in or register to report this question.

13.

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

Exam Year(s)

MH SET - 2020, SET Exam - 2020,

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))\).

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Algorithm Analysis and Complexity Questions and Answers || Algorithm Analysis and Complexity MCQ Questions and Answers || Algorithm Analysis and Complexity GK Questions and Answers || Algorithm Analysis and Complexity GK MCQ Questions || Algorithm Analysis and Complexity Multiple Choice Questions and Answers || Algorithm Analysis and Complexity GK || GK on Algorithm Analysis and Complexity || Data Structures and Algorithms Questions and Answers || Data Structures and Algorithms MCQ Questions and Answers || Data Structures and Algorithms GK Questions and Answers || GK on Data Structures and Algorithms