Asked By : InformedA
Answered By : babou
- $f(n)in O(g(n))$ means $f$ is bounded above by $g$ up to a constant.
- $f(n)in Omega(g(n))$ means $f$ is bounded below by $g$ up to a constant.
- $f(n)in Theta(g(n))$ means $f(n)in O(g(n)) wedge f(n)in Omega(g(n))$
Further remarks (since the scope of the question is being implicitely extended) These definitions can be used for worst case as well for a best case analysis of complexity, starting from an analysis of respectively the greatest or least costs over all inputs of size $n$. Then, for algorithm $A$, let $A_{min}(n)$ and $A_{max}(n)$ be respectively the best case and worst case complexity of $A$. Then, omitting intentionally “worst case” or “best case”. so as to cover all cases, you can say that:
- the complexity of $A$ is $O(g(n)$ iff $A_{max}(n)in O(g(n)$
- the complexity of $A$ is $Omega(g(n)$ iff $A_{min}(n)in Omega(g(n)$
Now using the $Theta$-notation is not necessarily meaningful for this “overall” complexity of $A$. It is meaningful iff $O(A_{max}(n))=O(A_{min}(n))$ To be complete, many people also use average case analysis. Also, people often mean worst case when they omit qualification of the complexity.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/29284