UGC NET CS 2020Data Structures and Algorithms › Performance Analysis of Algorithms and RecurrencesVerified
UGC NET CS 2020 PYQ: The running time of an algorithm is $O(g(n))$ if and only if
The running time of an algorithm is $O(g(n))$ if and only if
- Aits worst-case running time is $O(g(n))$ and its best-case running time is $\Omega(g(n)) \cdot (O= \textit{ big }O)$Correct answer
- Bits worst-case running time is $\Omega (g(n))$ and its best-case running time is $O(g(n)) \cdot (O= \textit{ big }O)$
- C$O(g(n))= \Omega(g(n))(O=\textit{big } O)$
- D$O(g(n))\cap \omega(g(n))$ is non-empty set, $(o = \textit{ small } o)$
Answer
(A) its worst-case running time is $O(g(n))$ and its best-case running time is $\Omega(g(n)) \cdot (O= \textit{ big }O)$
Approach
Combine an upper bound on the worst case and a lower bound on the best case to bound all running times.
Reviewed by UGC IQ Editorial Team.