Redirected
edited by
1,913 views
2 votes
2 votes

The running time of an algorithm is $O(g(n))$ if and only if

  1. its worst-case running time is $O(g(n))$ and its best-case running time is $\Omega(g(n)) \cdot (O= \textit{ big }O)$
  2. its worst-case running time is $\Omega (g(n))$ and its best-case running time is $O(g(n)) \cdot (O= \textit{ big }O)$
  3. $O(g(n))= \Omega(g(n))(O=\textit{big } O)$
  4. $O(g(n))\cap \omega(g(n))$ is non-empty set, $(o = \textit{ small } o)$

 

edited by

4 Answers

3 votes
3 votes
Option (A) Worst case of algorithm is $O(g(n))$, means that in worst case the algorithm's time complexity grows (asymptotically or for sufficiently large $n$) no faster than $g(n)$.

Best case of algorithm is $\Omega(g(n)$, means that in best case inputs, the algorithm's time complexity grows at least as fast as $g(n)$.

From these two statements we can conclude that best case time complexity of algorithm is $\Theta(g(n))$ and worst case time complexity of algorithm is $\Theta(g(n))$.

From this we can conclude that, average case time complexity will also be $\Theta(g(n))$.

Which implies algorithm's running time complexity is $\Theta(g(n))$ which in turn implies algorithm's running time complexity is $O(g(n))$.

That is, Option (A) implies running time complexity is $O(g(n))$.

But running time complexity is $O(g(n))$ does not imply Option (A).

For this counter example is Insertion sort, it's running time complexity is $O(n^2)$, worst case time complexity is $O(n^2)$ but it's best case time complexity is not $\Omega(n^2)$.

Therefore, option (A) must be False.
edited by
1 votes
1 votes
1. (A only)
 for the best case, the time complexity will be minimum and would be omega(n) and for the worst case, it would be O(g(n)).
0 votes
0 votes

According to me option C is correct.

As for option A, if worst case becomes 0( g(n)) and best case becomes Ω( g(n)) then the running time becomes Θ( g(n))

as every time complexity is the upper and lower bound to itself.

 

Whereas for option C, since the upper bound and lower bound are same, it doesn’t matter if we mention the 0( g(n)) or Ω( g(n)) as both are same.

0 votes
0 votes

O(g(n)) gives the upper bound on a algorithm and Ω(g(n)) gives the lower bound. Hence Option A should be correct.

Answer:

Related questions

0 votes
0 votes
1 answer
2
go_editor asked Nov 20, 2020
794 views
Match $\text{List I}$ with $\text{List II}$With reference to CMM developed by Software Engineering Institute (SEI)$\begin{array}{llll} & \text{List I} && \text{List II} \...
0 votes
0 votes
2 answers
3
go_editor asked Nov 20, 2020
998 views
Match $\text{list I}$ with $\text{List II}$$\begin{array}{llll} & \text{List I} && \text{List II} \\ (A) & \text{Topological sort of DAG} & (I) & O(V+E) \\ (B) & \text{Kr...
1 votes
1 votes
1 answer
4
go_editor asked Nov 20, 2020
874 views
Match $\text{List I}$ with $\text{List II}$$\begin{array}{llll} & \text{List I} & & \text{List II} \\ (A) & \text{Greedy Best-First Search} & (I) & \text{Space complexity...